text
stringlengths
11
4.05M
package cache import ( "testing" "time" "github.com/gomodule/redigo/redis" ) func DoTestCache(t *testing.T, c Cache) { // not found if v, err := c.Get("a"); v != nil || err != NotFound { t.Error(err, "should value nil and err not found") } time.Sleep(time.Millisecond) if v, err := c.Get("a"); v != nil || err != NotFound { t.Error(err, "should value nil and err not found") } time.Sleep(time.Millisecond) // set and found if err := c.Set("a", []byte{'b'}, time.Millisecond*100); err != nil { t.Error(err) } time.Sleep(time.Millisecond) if v, err := c.Get("a"); string(v) != "b" || err != nil { t.Error(err, "should value and no error") } time.Sleep(time.Millisecond) if v, err := c.Get("a"); string(v) != "b" || err != nil { t.Error(err, "should value and no error") } time.Sleep(time.Second * 1) if v, err := c.Get("a"); v != nil || err != NotFound { t.Error(v, err, "should value nil and err not found") } time.Sleep(time.Millisecond) // set nil and found nil // disabled due to unable to distinglish // nil, empty bytes and not found for redis /* if err := c.Set("n", nil, time.Minute*1); err != nil { t.Error("should nil value and no error") } if v, err := c.Get("n"); v != nil || err != nil { t.Error("should nil value and no error") } if v, err := c.Get("n"); v != nil || err != nil { t.Error("should nil value and no error") } */ // test JSON JSONMarshal JSONUnmarshal var v []int if err := JSONUnmarshal(c, "a", v); err != NotFound { t.Error(err, "should value nil and err not found") } time.Sleep(time.Millisecond) if err := JSONUnmarshal(c, "a", v); err != NotFound { t.Error(err, "should value nil and err not found") } time.Sleep(time.Millisecond) // set and found if err := JSONMarshal(c, "a", []int{1, 2, 3}, time.Millisecond*100); err != nil { t.Error(err) } time.Sleep(time.Millisecond) if raw, err := c.Get("a"); string(raw) != "[1,2,3]" || err != nil { t.Error(err, "should value and no error") } time.Sleep(time.Millisecond) if err := JSONUnmarshal(c, "a", &v); len(v) != 3 || v[2] != 3 || err != nil { t.Error(err, "should value and no error") } time.Sleep(time.Second * 1) if v, err := c.Get("a"); v != nil || err != NotFound { t.Error(v, err, "should value nil and err not found") } } func TestLocal(t *testing.T) { DoTestCache(t, NewLocal(10, int64(10<<20), -1)) } func TestRedis(t *testing.T) { DoTestCache(t, NewRedis(&redis.Pool{ Dial: func() (conn redis.Conn, err error) { return redis.Dial("tcp", ":6379") }, })) } func TestHybrid(t *testing.T) { DoTestCache(t, NewHybrid(&redis.Pool{ Dial: func() (conn redis.Conn, err error) { return redis.Dial("tcp", ":6379") }, }, NewLocal(10, int64(10<<20), time.Minute*1))) } func TestHybridRedis(t *testing.T) { DoTestCache(t, NewHybrid(&redis.Pool{ Dial: func() (conn redis.Conn, err error) { return redis.Dial("tcp", ":6379") }, }, NewLocal(10, int64(10<<20), time.Nanosecond))) }
package main import ( "github.com/codegangsta/cli" ) func NewHostCommand() cli.Command { return cli.Command{ Name: "host", Usage: "Operations with vulcan hosts", Subcommands: []cli.Command{ { Name: "add", Flags: []cli.Flag{ cli.StringFlag{"name", "", "hostname"}, }, Usage: "Add a new host to vulcan proxy", Action: addHostAction, }, { Name: "rm", Flags: []cli.Flag{ cli.StringFlag{"name", "", "hostname"}, }, Usage: "Remove a host from vulcan", Action: deleteHostAction, }, }, } } func addHostAction(c *cli.Context) { printStatus(client(c).AddHost(c.String("name"))) } func deleteHostAction(c *cli.Context) { printStatus(client(c).DeleteHost(c.String("name"))) }
package main import ( "github.com/garyburd/redigo/redis" "fmt" ) func main() { connect, err := redis.Dial("tcp", "localhost:6379") if err != nil { fmt.Println("connect redis err:", err) return } defer connect.Close() _, err = connect.Do("HSet", "books", "abc", 100) if err != nil { fmt.Println("set err:", err) return } r, err := redis.Int(connect.Do("HGet", "books","abc")) if err != nil { fmt.Println("get abc err:", err) return } fmt.Println("result:", r) }
package clog import ( "io" ) type Topic struct { name string config TopicConfig log *Log writer *io.Writer } func newTopic(config TopicConfig) *Topic { return &Topic{} }
package utils import ( "bytes" "fmt" "os" "strings" "text/template" "github.com/docker/go-units" "github.com/urfave/cli/v2" corepb "github.com/projecteru2/core/rpc/gen" ) // GetNetworks returns a networkmode -> ip map func GetNetworks(network string) map[string]string { var ip string networkInfo := strings.Split(network, "=") if len(networkInfo) == 2 { network = networkInfo[0] ip = networkInfo[1] } networks := map[string]string{} if network != "" { networks[network] = ip } return networks } // ParseRAMInHuman returns int value in bytes of a human readable string // e.g. 100KB -> 102400 func ParseRAMInHuman(ram string) (int64, error) { if ram == "" { return 0, nil } flag := int64(1) if strings.HasPrefix(ram, "-") { flag = int64(-1) ram = strings.TrimLeft(ram, "-") } ramInBytes, err := units.RAMInBytes(ram) if err != nil { return 0, err } return ramInBytes * flag, nil } // SplitEquality transfers a list of // aaa=bbb, xxx=yyy into // {aaa:bbb, xxx:yyy} func SplitEquality(elements []string) map[string]string { r := map[string]string{} for _, e := range elements { p := strings.SplitN(e, "=", 2) if len(p) != 2 { continue } r[p[0]] = p[1] } return r } // EnvParser . func EnvParser(b []byte) ([]byte, error) { tmpl, err := template.New("tmpl").Option("missingkey=default").Parse(string(b)) if err != nil { return b, err } out := bytes.Buffer{} err = tmpl.Execute(&out, SplitEquality(os.Environ())) return out.Bytes(), err } // ExitCoder wraps a cli Action function into // a function with ExitCoder interface func ExitCoder(f func(*cli.Context) error) func(*cli.Context) error { return func(c *cli.Context) error { if err := f(c); err != nil { if exitErr, ok := err.(cli.ExitCoder); ok { return cli.Exit(exitErr, exitErr.ExitCode()) } return cli.Exit(err, -1) } return nil } } // GetHostname . func GetHostname() string { hostname, _ := os.Hostname() return hostname } // ToPBRawParamsString . func ToPBRawParamsString(v interface{}) *corepb.RawParam { return &corepb.RawParam{Value: &corepb.RawParam_Str{Str: fmt.Sprintf("%v", v)}} } // ToPBRawParamsStringSlice . func ToPBRawParamsStringSlice(slice []string) *corepb.RawParam { return &corepb.RawParam{Value: &corepb.RawParam_StringSlice{StringSlice: &corepb.StringSlice{Slice: slice}}} }
package main // TODO: handle erors properly import ( "encoding/json" "fmt" "net/http" "os" "strings" ) func main() { // get the port heroku assignened for us port := os.Getenv("PORT") if port == "" { // ....if heroku didn't give us a port (DEBUG) port = "8080" } // set up default path http.HandleFunc("/", handleBadRequest) // set up request handler http.HandleFunc("/projectinfo/v1/github.com/", handleRequest) // start listening on port fmt.Println("Listening on port " + port + "...") err := http.ListenAndServe(":"+port, nil) // if error, panic if err != nil { panic(err) } } // handler for when invalid path is used func handleBadRequest(res http.ResponseWriter, req *http.Request) { status := http.StatusBadRequest http.Error(res, http.StatusText(status), status) } // handler for dealing with requests func handleRequest(res http.ResponseWriter, req *http.Request) { // only GET is legal. only handle GET if req.Method == "GET" { // split URL to fetch information ([3:] are interesting) parts := strings.Split(req.URL.String(), "/") // if it AT LEAST has user(4) and repo(5), do stuff. if not: bad request if len(parts) > 5 { user := parts[4] repo := parts[5] // generate payload based on user, repo payload, pErr := generateResponsePayload(user, repo) // errorcheck payload and write if pErr == nil { http.Header.Add(res.Header(), "content-type", "application/json") json.NewEncoder(res).Encode(payload) } else { // NOTE: Need to show different status depending on error. // The following is a BAD solution to the problem, very // TODO "ad-hoc". Needs improvenemt var status int if pErr.Error() == "unexpected end of JSON input" { status = http.StatusBadRequest } else { status = http.StatusServiceUnavailable } http.Error(res, http.StatusText(status), status) } } else { handleBadRequest(res, req) } } else { // not GET. bad status := http.StatusNotImplemented http.Error(res, http.StatusText(status), status) } }
// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package server import ( "context" "encoding/json" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "cloud.google.com/go/bigtable" "github.com/datacommonsorg/mixer/internal/store" "github.com/datacommonsorg/mixer/internal/util" pb "github.com/datacommonsorg/mixer/internal/proto" ) // GetPropertyValues implements API for Mixer.GetPropertyValues. func (s *Server) GetPropertyValues(ctx context.Context, in *pb.GetPropertyValuesRequest) (*pb.GetPropertyValuesResponse, error) { dcids := in.GetDcids() prop := in.GetProperty() typ := in.GetValueType() direction := in.GetDirection() limit := int(in.GetLimit()) // Check arguments if prop == "" || len(dcids) == 0 { return nil, status.Errorf(codes.InvalidArgument, "Missing required arguments") } if !util.CheckValidDCIDs(dcids) { return nil, status.Errorf(codes.InvalidArgument, "Invalid DCIDs") } // Get in, out or both direction var ( inArc = true outArc = true inRes = map[string][]*Node{} outRes = map[string][]*Node{} ) var err error if direction == "in" { outArc = false } else if direction == "out" { inArc = false } if inArc { inRes, err = getPropertyValuesHelper(ctx, s.store, dcids, prop, false) if err != nil { return nil, err } } if outArc { outRes, err = getPropertyValuesHelper(ctx, s.store, dcids, prop, true) if err != nil { return nil, err } } result := make(map[string]map[string][]*Node) for _, dcid := range dcids { result[dcid] = map[string][]*Node{} } for dcid, nodes := range inRes { trimedNodes := trimNodes(nodes, typ, limit) if len(trimedNodes) > 0 { result[dcid]["in"] = trimedNodes } } for dcid, nodes := range outRes { trimedNodes := trimNodes(nodes, typ, limit) if len(trimedNodes) > 0 { result[dcid]["out"] = trimedNodes } } jsonRaw, err := json.Marshal(result) if err != nil { return nil, err } return &pb.GetPropertyValuesResponse{Payload: string(jsonRaw)}, nil } func getPropertyValuesHelper( ctx context.Context, store *store.Store, dcids []string, prop string, arcOut bool, ) (map[string][]*Node, error) { rowList := buildPropertyValuesKey(dcids, prop, arcOut) // Current branch cache is targeted on new stats (without addition of schema etc), // so only use base cache data for property value. // // TODO(shifucun): perform a systematic check on current cache data and see // if this is still true. return readPropertyValues(ctx, store, rowList) } func trimNodes(nodes []*Node, typ string, limit int) []*Node { if limit == 0 && typ == "" { return nodes } result := []*Node{} for _, node := range nodes { if typ == "" { result = append(result, node) } else { for _, t := range node.Types { if t == typ { result = append(result, node) break } } } if limit > 0 && len(result) == limit { break } } return result } func readPropertyValues( ctx context.Context, store *store.Store, rowList bigtable.RowList, ) (map[string][]*Node, error) { // Only read property value from base cache. // Branch cache only contains supplement data but not other properties yet. baseDataMap, _, err := bigTableReadRowsParallel(ctx, store, rowList, func(dcid string, jsonRaw []byte) (interface{}, error) { var propVals PropValueCache err := json.Unmarshal(jsonRaw, &propVals) if err != nil { return nil, err } return propVals.Nodes, nil }, nil) if err != nil { return nil, err } result := map[string][]*Node{} for dcid, data := range baseDataMap { result[dcid] = data.([]*Node) } return result, nil }
package gohttp import ( "errors" "net/http" ) func (c *httpClient) do(method, url string, headers http.Header, body interface{}) (*http.Response, error) { client := http.Client{} request, err := http.NewRequest(method, url, nil) if err != nil { return nil, errors.New("unable to create a request") } fullHeaders := c.getRequestHeaders(headers) request.Header = fullHeaders return client.Do(request) } func (c *httpClient) getRequestHeaders(requestHeaders http.Header) http.Header { result := make(http.Header) // Add common headers to the request for header, value := range c.Headers { if len(value) > 0 { result.Set(header, value[0]) } } // Add custom headers to the request for header, value := range requestHeaders { if len(value) > 0 { result.Set(header, value[0]) } } return result }
package main import ( "bufio" "flag" "fmt" "os" "github.com/Shopify/sarama" ) // producer kafka func Producer() { addr := flag.String("kafka_addr", "", "kafka_addr") topic := flag.String("kafka_topic", "", "kafka_topic") flag.Parse() if len(*addr) == 0 || len(*topic) == 0 { panic(`please input params example "--kafka_addr 10.0.0.159:9092 --kafka_topic default"`) } config := sarama.NewConfig() config.Producer.RequiredAcks = sarama.WaitForAll config.Producer.Partitioner = sarama.NewRandomPartitioner config.Producer.Return.Successes = true msg := &sarama.ProducerMessage{} msg.Topic = *topic client, err := sarama.NewSyncProducer([]string{*addr}, config) if err != nil { fmt.Println("producer close, err:", err) return } for { fmt.Println("please input producer data:") input := bufio.NewScanner(os.Stdin) input.Scan() msg.Value = sarama.StringEncoder(input.Bytes()) pid, offset, err := client.SendMessage(msg) if err != nil { fmt.Println("send message failed,", err) continue } fmt.Printf("pid:%v offset:%v\n", pid, offset) } client.Close() } func main() { Producer() }
/* * @lc app=leetcode.cn id=207 lang=golang * * [207] 课程表 */ package main import ( "fmt" ) /* // DFS // 0表示没访问 // 1表示当前dfs访问过 // 2表示其他dfs分支访问过 func canFinish(numCourses int, prerequisites [][]int) bool { var ( edges = make([][]int, numCourses) visited = make([]int, numCourses) result []int valid = true dfs func(u int) ) dfs = func(u int) { visited[u] = 1 for _, v := range edges[u] { if visited[v] == 0 { dfs(v) if !valid { return } } else if visited[v] == 1 { valid = false return } } visited[u] = 2 result = append(result, u) } for _, info := range prerequisites { edges[info[1]] = append(edges[info[1]], info[0]) } for i := 0; i < numCourses && valid; i++ { if visited[i] == 0 { dfs(i) } } return valid } */ // 拓扑排序 // 则没有环 // @lc code=start func canFinish(numCourses int, prerequisites [][]int) bool { indegree := make([]int, numCourses) graph := make(map[int][]int) queue := make([]int, 0) count := 0 for _, v := range prerequisites { indegree[v[0]]++ graph[v[1]] = append(graph[v[1]], v[0]) } for i, v := range indegree { if v == 0 { queue = append(queue, i) } } for len(queue) != 0 { class := queue[0] queue = queue[1:] // 学习课程数 count++ need := graph[class] for _, v := range need { indegree[v]-- if indegree[v] == 0 { queue = append(queue, v) } } } // 如果不相等则说明 课程未完成 return count == numCourses } // @lc code=end func main() { fmt.Println(canFinish(2, [][]int{{0, 1}, {1, 0}})) }
package main import ( "bufio" "encoding/binary" "encoding/json" "fmt" "github.com/boltdb/bolt" "log" "os" ) type ProcessorPool struct { Pool chan chan string maxWorkers int } var ProcessQueue chan string type Processor struct { Pool chan chan string ProcessChannel chan string quit chan bool } func handleRecipient(message *Message, recipientText string) { if recipientText != "" { mail := Mail{MessageId: message.Id, From: message.From, Subject: message.Subject} err := json.Unmarshal([]byte(recipientText), &mail) if err != nil { log.Println(err) } else { JobQueue <- Job{Message: mail} } } } func process(fileName string) { var message *Message var err error file, err := os.Open(fileName) if err != nil { log.Fatal(err) } defer file.Close() scanner := bufio.NewScanner(file) for scanner.Scan() { if message == nil { message = &Message{} err = json.Unmarshal([]byte(scanner.Text()), message) if err != nil { log.Fatal(err) } log.Printf("Sending message %s to %d recipients!\n", message.Id, message.RecipientCount) EventQueue <- Event{RecipientId: "", MessageId: message.Id, Status: "starting"} err = Database.Update(func(tx *bolt.Tx) error { bucket := tx.Bucket([]byte("Messages")) count := make([]byte, 4) binary.LittleEndian.PutUint32(count, message.RecipientCount) err := bucket.Put([]byte(fmt.Sprintf("%s:Count", message.Id)), count) if err != nil { return err } return bucket.Put([]byte(message.Id), []byte(message.Body)) }) if err != nil { log.Fatal(err) } } else { handleRecipient(message, scanner.Text()) } } if err := scanner.Err(); err != nil { log.Fatal(err) } } func NewProcessor(pool chan chan string) Processor { return Processor{ Pool: pool, ProcessChannel: make(chan string), quit: make(chan bool), } } func (p Processor) Start() { go func() { for { p.Pool <- p.ProcessChannel select { case fileName := <-p.ProcessChannel: process(fileName) case <-p.quit: return } } }() } func (p Processor) Stop() { go func() { p.quit <- true }() } func NewProcessorPool(maxWorkers int) *ProcessorPool { pool := make(chan chan string, maxWorkers) return &ProcessorPool{Pool: pool, maxWorkers: maxWorkers} } func (p *ProcessorPool) Run() { for i := 0; i < p.maxWorkers; i++ { processor := NewProcessor(p.Pool) processor.Start() } go p.dispatch() } func (p *ProcessorPool) dispatch() { for { select { case request := <-ProcessQueue: go func(fileName string) { processorChannel := <-p.Pool processorChannel <- fileName }(request) } } }
package main import ( "fmt" "os" "os/exec" "time" ) // Terminal size const ( WIDTH = 10 HEIGHT = 5 ) func getCell(board []int, x int, y int) int { if x < 0 || x > WIDTH { return 0 } else if y < 0 || y > HEIGHT { return 0 } return board[x+(y*WIDTH)] } // Since i am using integers to represent alive ( 1 ) and dead ( 0 ) i can just add them up. func countNeighbor(board []int, x int, y int) int { counter := getCell(board[:], x+1, y) + getCell(board[:], x+1, y+1) + getCell(board[:], x+1, y-1) + getCell(board[:], x, y+1) + getCell(board[:], x, y-1) + getCell(board[:], x-1, y) + getCell(board[:], x-1, y+1) + getCell(board[:], x-1, y-1) return counter } func clearTerm() { cmd := exec.Command("clear") cmd.Stdout = os.Stdout cmd.Run() } func draw(board []int, cursor []int) { for y := 0; y < HEIGHT; y++ { for x := 0; x < WIDTH; x++ { if x == cursor[0] && y == cursor[1] { fmt.Print("x") } else { fmt.Print(getCell(board[:], x, y)) } } if y == 0 { fmt.Printf(" Simulating: %t", false) } else if y == 1 { fmt.Printf(" Generation: %d", 0) } fmt.Print("\n") } } func control(cursor []int, generation *int, simulation *bool) { stdin := make([]byte, 3) os.Stdin.Read(stdin) if stdin[0] == 27 && stdin[1] == 91 { // Right arrow key. if stdin[2] == 67 { cursor[0] = cursor[0] + 1 } // Left arrow key. if stdin[2] == 68 { cursor[0] = cursor[0] - 1 } // Down arrow key. if stdin[2] == 65 { cursor[1] = cursor[1] - 1 } // Up arrow key. if stdin[2] == 66 { cursor[1] = cursor[1] + 1 } } // Make sure cursor is between boundaries. if cursor[0] < 0 { cursor[0] = 0 } else if cursor[0] >= WIDTH { cursor[0] = WIDTH - 1 } if cursor[1] < 0 { cursor[1] = 0 } else if cursor[1] >= HEIGHT { cursor[1] = HEIGHT - 1 } // Clear stdin not sure if necessary but did anyway. stdin[0] = 0 stdin[1] = 0 stdin[2] = 0 } func main() { // https://stackoverflow.com/questions/15159118/read-a-character-from-standard-input-in-go-without-pressing-enter/17278776#17278776 exec.Command("stty", "-F", "/dev/tty", "cbreak", "min", "1").Run() // Disable input buffering exec.Command("stty", "-F", "/dev/tty", "-echo").Run() // Do not display entered characters on the screen var board [WIDTH * HEIGHT]int cursor := [2]int{0, 0} generation := 0 simulating := false for { clearTerm() go control(cursor[:], &generation, &simulating) draw(board[:], cursor[:]) time.Sleep(100 * time.Millisecond) } }
// Package evaluator contains the core of our interpreter, which walks // the AST produced by the parser and evaluates the user-submitted program. package evaluator import ( "bytes" "fmt" "math" "os" "os/exec" "regexp" "strings" "github.com/kasworld/nonkey/config/builtinfunctions" "github.com/kasworld/nonkey/config/pragmas" "github.com/kasworld/nonkey/enum/objecttype" "github.com/kasworld/nonkey/enum/tokentype" "github.com/kasworld/nonkey/interpreter/ast" "github.com/kasworld/nonkey/interpreter/asti" "github.com/kasworld/nonkey/interpreter/object" ) // Eval is our core function for evaluating nodes. func Eval(node asti.NodeI, env *object.Environment) object.ObjectI { switch node := node.(type) { //Statements case *ast.Program: return evalProgram(node, env) case *ast.ExpressionStatement: return Eval(node.Expression, env) //Expressions case *ast.IntegerLiteral: return &object.Integer{Value: node.Value} case *ast.FloatLiteral: return &object.Float{Value: node.Value} case *ast.Boolean: return nativeBoolToBooleanObject(node.Value) case *ast.PrefixExpression: right := Eval(node.Right, env) if object.IsError(right) { return right } return evalPrefixExpression(node, node.Operator, right) case *ast.PostfixExpression: return evalPostfixExpression(env, node.Operator, node) case *ast.InfixExpression: left := Eval(node.Left, env) if object.IsError(left) { return left } right := Eval(node.Right, env) if object.IsError(right) { return right } res := evalInfixExpression(node, node.Operator, left, right, env) if object.IsError(res) { fmt.Fprintf(os.Stderr, "%s\n", res.Inspect()) if pragmas.PRAGMAS["strict"] == 1 { os.Exit(1) } } return (res) case *ast.BlockStatement: return evalBlockStatement(node, env) case *ast.IfExpression: return evalIfExpression(node, env) case *ast.TernaryExpression: return evalTernaryExpression(node, env) case *ast.ForLoopExpression: return evalForLoopExpression(node, env) case *ast.ForeachStatement: return evalForeachExpression(node, env) case *ast.ReturnStatement: val := Eval(node.ReturnValue, env) if object.IsError(val) { return val } return &object.ReturnValue{Value: val} case *ast.LetStatement: val := Eval(node.Value, env) if object.IsError(val) { return val } env.Set(node.Name.Value, val) return val case *ast.ConstStatement: val := Eval(node.Value, env) if object.IsError(val) { return val } env.SetConst(node.Name.Value, val) return val case *ast.Identifier: return evalIdentifier(node, env) case *ast.FunctionLiteral: params := node.Parameters body := node.Body defaults := node.Defaults return &object.Function{Parameters: params, Env: env, Body: body, Defaults: defaults} case *ast.FunctionDefineLiteral: params := node.Parameters body := node.Body defaults := node.Defaults env.Set(node.GetToken().Literal, &object.Function{Parameters: params, Env: env, Body: body, Defaults: defaults}) return object.NULL case *ast.ObjectCallExpression: res := evalObjectCallExpression(node, env) if object.IsError(res) { fmt.Fprintf(os.Stderr, "%s\n", res.Inspect()) if pragmas.PRAGMAS["strict"] == 1 { os.Exit(1) } } return res case *ast.CallExpression: function := Eval(node.Function, env) if object.IsError(function) { return function } args := evalExpression(node.Arguments, env) if len(args) == 1 && object.IsError(args[0]) { return args[0] } res := applyFunction(node, env, function, args) if object.IsError(res) { fmt.Fprintf(os.Stderr, "%v %v\n", res.Inspect(), node.Function) if pragmas.PRAGMAS["strict"] == 1 { os.Exit(1) } return res } return res case *ast.ArrayLiteral: elements := evalExpression(node.Elements, env) if len(elements) == 1 && object.IsError(elements[0]) { return elements[0] } return &object.Array{Elements: elements} case *ast.StringLiteral: return &object.String{Value: node.Value} case *ast.RegexpLiteral: return &object.Regexp{Value: node.Value, Flags: node.Flags} case *ast.BacktickLiteral: return backTickOperation(node.Value) case *ast.IndexExpression: left := Eval(node.Left, env) if object.IsError(left) { return left } index := Eval(node.Index, env) if object.IsError(index) { return index } return evalIndexExpression(node, left, index) case *ast.AssignStatement: return evalAssignStatement(node, env) case *ast.HashLiteral: return evalHashLiteral(node, env) case *ast.SwitchExpression: return evalSwitchStatement(node, env) } return nil } // eval block statement func evalBlockStatement(block *ast.BlockStatement, env *object.Environment) object.ObjectI { var result object.ObjectI for _, statement := range block.Statements { result = Eval(statement, env) if result != nil { rt := result.Type() if rt == objecttype.RETURN_VALUE || rt == objecttype.ERROR { return result } } } return result } // for performance, using single instance of boolean func nativeBoolToBooleanObject(input bool) *object.Boolean { if input { return object.TRUE } return object.FALSE } // eval prefix expression func evalPrefixExpression(node asti.NodeI, operator tokentype.TokenType, right object.ObjectI) object.ObjectI { switch operator { case tokentype.BANG: return evalBangOperatorExpression(right) case tokentype.MINUS: return evalMinusPrefixOperatorExpression(node, right) default: return object.NewError(node, "unknown operator: %s%s", operator.Literal(), right.Type()) } } func evalPostfixExpression(env *object.Environment, operator tokentype.TokenType, node *ast.PostfixExpression) object.ObjectI { switch operator { case tokentype.PLUS_PLUS: val, ok := env.Get(node.Token.Literal) if !ok { return object.NewError(node, "%s is unknown", node.Token.Literal) } switch arg := val.(type) { case *object.Integer: v := arg.Value env.Set(node.Token.Literal, &object.Integer{Value: v + 1}) return arg default: return object.NewError(node, "%s is not an int", node.Token.Literal) } case tokentype.MINUS_MINUS: val, ok := env.Get(node.Token.Literal) if !ok { return object.NewError(node, "%s is unknown", node.Token.Literal) } switch arg := val.(type) { case *object.Integer: v := arg.Value env.Set(node.Token.Literal, &object.Integer{Value: v - 1}) return arg default: return object.NewError(node, "%s is not an int", node.Token.Literal) } default: return object.NewError(node, "unknown operator: %s", operator.Literal()) } } func evalBangOperatorExpression(right object.ObjectI) object.ObjectI { switch right { case object.TRUE: return object.FALSE case object.FALSE: return object.TRUE case object.NULL: return object.TRUE default: return object.FALSE } } func evalMinusPrefixOperatorExpression(node asti.NodeI, right object.ObjectI) object.ObjectI { switch obj := right.(type) { case *object.Integer: return &object.Integer{Value: -obj.Value} case *object.Float: return &object.Float{Value: -obj.Value} default: return object.NewError(node, "unknown operator: -%s", right.Type()) } } func evalInfixExpression(node asti.NodeI, operator tokentype.TokenType, left, right object.ObjectI, env *object.Environment) object.ObjectI { switch { case left.Type() == objecttype.INTEGER && right.Type() == objecttype.INTEGER: return evalIntegerInfixExpression(node, operator, left, right) case left.Type() == objecttype.FLOAT && right.Type() == objecttype.FLOAT: return evalFloatInfixExpression(node, operator, left, right) case left.Type() == objecttype.FLOAT && right.Type() == objecttype.INTEGER: return evalFloatIntegerInfixExpression(node, operator, left, right) case left.Type() == objecttype.INTEGER && right.Type() == objecttype.FLOAT: return evalIntegerFloatInfixExpression(node, operator, left, right) case left.Type() == objecttype.STRING && right.Type() == objecttype.STRING: return evalStringInfixExpression(node, operator, left, right) case operator == tokentype.AND: return nativeBoolToBooleanObject(objectToNativeBoolean(left) && objectToNativeBoolean(right)) case operator == tokentype.OR: return nativeBoolToBooleanObject(objectToNativeBoolean(left) || objectToNativeBoolean(right)) case operator == tokentype.NOT_CONTAINS: return notMatches(node, left, right) case operator == tokentype.CONTAINS: return matches(node, left, right, env) case operator == tokentype.EQ: return nativeBoolToBooleanObject(left == right) case operator == tokentype.NOT_EQ: return nativeBoolToBooleanObject(left != right) case left.Type() == objecttype.BOOLEAN && right.Type() == objecttype.BOOLEAN: return evalBooleanInfixExpression(node, operator, left, right) case left.Type() != right.Type(): return object.NewError(node, "type mismatch: %s %s %s", left.Type(), operator.Literal(), right.Type()) default: return object.NewError(node, "unknown operator: %s %s %s", left.Type(), operator.Literal(), right.Type()) } } func matches(node asti.NodeI, left, right object.ObjectI, env *object.Environment) object.ObjectI { str := left.Inspect() if right.Type() != objecttype.REGEXP { return object.NewError(node, "regexp required for regexp-match, given %s", right.Type()) } val := right.(*object.Regexp).Value if right.(*object.Regexp).Flags != "" { val = "(?" + right.(*object.Regexp).Flags + ")" + val } // Compile the regular expression. r, err := regexp.Compile(val) // Ensure it compiled if err != nil { return object.NewError(node, "error compiling regexp '%s': %s", right.Inspect(), err) } res := r.FindStringSubmatch(str) // Do we have any captures? if len(res) > 1 { for i := 1; i < len(res); i++ { env.Set(fmt.Sprintf("$%d", i), &object.String{Value: res[i]}) } } // Test if it matched if len(res) > 0 { return object.TRUE } return object.FALSE } func notMatches(node asti.NodeI, left, right object.ObjectI) object.ObjectI { str := left.Inspect() if right.Type() != objecttype.REGEXP { return object.NewError(node, "regexp required for regexp-match, given %s", right.Type()) } val := right.(*object.Regexp).Value if right.(*object.Regexp).Flags != "" { val = "(?" + right.(*object.Regexp).Flags + ")" + val } // Compile the regular expression. r, err := regexp.Compile(val) // Ensure it compiled if err != nil { return object.NewError(node, "error compiling regexp '%s': %s", right.Inspect(), err) } // Test if it matched if r.MatchString(str) { return object.FALSE } return object.TRUE } // boolean operations func evalBooleanInfixExpression(node asti.NodeI, operator tokentype.TokenType, left, right object.ObjectI) object.ObjectI { // convert the bools to strings. l := &object.String{Value: string(left.Inspect())} r := &object.String{Value: string(right.Inspect())} switch operator { case tokentype.LT: return evalStringInfixExpression(node, operator, l, r) case tokentype.LT_EQUALS: return evalStringInfixExpression(node, operator, l, r) case tokentype.GT: return evalStringInfixExpression(node, operator, l, r) case tokentype.GT_EQUALS: return evalStringInfixExpression(node, operator, l, r) default: return object.NewError(node, "unknown operator: %s %s %s", left.Type(), operator.Literal(), right.Type()) } } func evalIntegerInfixExpression(node asti.NodeI, operator tokentype.TokenType, left, right object.ObjectI) object.ObjectI { leftVal := left.(*object.Integer).Value rightVal := right.(*object.Integer).Value switch operator { case tokentype.PLUS: return &object.Integer{Value: leftVal + rightVal} case tokentype.PLUS_EQUALS: return &object.Integer{Value: leftVal + rightVal} case tokentype.MOD: return &object.Integer{Value: leftVal % rightVal} case tokentype.POW: return &object.Integer{Value: int64(math.Pow(float64(leftVal), float64(rightVal)))} case tokentype.MINUS: return &object.Integer{Value: leftVal - rightVal} case tokentype.MINUS_EQUALS: return &object.Integer{Value: leftVal - rightVal} case tokentype.ASTERISK: return &object.Integer{Value: leftVal * rightVal} case tokentype.ASTERISK_EQUALS: return &object.Integer{Value: leftVal * rightVal} case tokentype.SLASH: return &object.Integer{Value: leftVal / rightVal} case tokentype.SLASH_EQUALS: return &object.Integer{Value: leftVal / rightVal} case tokentype.LT: return nativeBoolToBooleanObject(leftVal < rightVal) case tokentype.LT_EQUALS: return nativeBoolToBooleanObject(leftVal <= rightVal) case tokentype.GT: return nativeBoolToBooleanObject(leftVal > rightVal) case tokentype.GT_EQUALS: return nativeBoolToBooleanObject(leftVal >= rightVal) case tokentype.EQ: return nativeBoolToBooleanObject(leftVal == rightVal) case tokentype.NOT_EQ: return nativeBoolToBooleanObject(leftVal != rightVal) case tokentype.DOTDOT: len := int(rightVal-leftVal) + 1 array := make([]object.ObjectI, len) i := 0 for i < len { array[i] = &object.Integer{Value: leftVal} leftVal++ i++ } return &object.Array{Elements: array} default: return object.NewError(node, "unknown operator: %s %s %s", left.Type(), operator.Literal(), right.Type()) } } func evalFloatInfixExpression(node asti.NodeI, operator tokentype.TokenType, left, right object.ObjectI) object.ObjectI { leftVal := left.(*object.Float).Value rightVal := right.(*object.Float).Value switch operator { case tokentype.PLUS: return &object.Float{Value: leftVal + rightVal} case tokentype.PLUS_EQUALS: return &object.Float{Value: leftVal + rightVal} case tokentype.MINUS: return &object.Float{Value: leftVal - rightVal} case tokentype.MINUS_EQUALS: return &object.Float{Value: leftVal - rightVal} case tokentype.ASTERISK: return &object.Float{Value: leftVal * rightVal} case tokentype.ASTERISK_EQUALS: return &object.Float{Value: leftVal * rightVal} case tokentype.POW: return &object.Float{Value: math.Pow(leftVal, rightVal)} case tokentype.SLASH: return &object.Float{Value: leftVal / rightVal} case tokentype.SLASH_EQUALS: return &object.Float{Value: leftVal / rightVal} case tokentype.LT: return nativeBoolToBooleanObject(leftVal < rightVal) case tokentype.LT_EQUALS: return nativeBoolToBooleanObject(leftVal <= rightVal) case tokentype.GT: return nativeBoolToBooleanObject(leftVal > rightVal) case tokentype.GT_EQUALS: return nativeBoolToBooleanObject(leftVal >= rightVal) case tokentype.EQ: return nativeBoolToBooleanObject(leftVal == rightVal) case tokentype.NOT_EQ: return nativeBoolToBooleanObject(leftVal != rightVal) default: return object.NewError(node, "unknown operator: %s %s %s", left.Type(), operator.Literal(), right.Type()) } } func evalFloatIntegerInfixExpression(node asti.NodeI, operator tokentype.TokenType, left, right object.ObjectI) object.ObjectI { leftVal := left.(*object.Float).Value rightVal := float64(right.(*object.Integer).Value) switch operator { case tokentype.PLUS: return &object.Float{Value: leftVal + rightVal} case tokentype.PLUS_EQUALS: return &object.Float{Value: leftVal + rightVal} case tokentype.MINUS: return &object.Float{Value: leftVal - rightVal} case tokentype.MINUS_EQUALS: return &object.Float{Value: leftVal - rightVal} case tokentype.ASTERISK: return &object.Float{Value: leftVal * rightVal} case tokentype.ASTERISK_EQUALS: return &object.Float{Value: leftVal * rightVal} case tokentype.POW: return &object.Float{Value: math.Pow(leftVal, rightVal)} case tokentype.SLASH: return &object.Float{Value: leftVal / rightVal} case tokentype.SLASH_EQUALS: return &object.Float{Value: leftVal / rightVal} case tokentype.LT: return nativeBoolToBooleanObject(leftVal < rightVal) case tokentype.LT_EQUALS: return nativeBoolToBooleanObject(leftVal <= rightVal) case tokentype.GT: return nativeBoolToBooleanObject(leftVal > rightVal) case tokentype.GT_EQUALS: return nativeBoolToBooleanObject(leftVal >= rightVal) case tokentype.EQ: return nativeBoolToBooleanObject(leftVal == rightVal) case tokentype.NOT_EQ: return nativeBoolToBooleanObject(leftVal != rightVal) default: return object.NewError(node, "unknown operator: %s %s %s", left.Type(), operator.Literal(), right.Type()) } } func evalIntegerFloatInfixExpression(node asti.NodeI, operator tokentype.TokenType, left, right object.ObjectI) object.ObjectI { leftVal := float64(left.(*object.Integer).Value) rightVal := right.(*object.Float).Value switch operator { case tokentype.PLUS: return &object.Float{Value: leftVal + rightVal} case tokentype.PLUS_EQUALS: return &object.Float{Value: leftVal + rightVal} case tokentype.MINUS: return &object.Float{Value: leftVal - rightVal} case tokentype.MINUS_EQUALS: return &object.Float{Value: leftVal - rightVal} case tokentype.ASTERISK: return &object.Float{Value: leftVal * rightVal} case tokentype.ASTERISK_EQUALS: return &object.Float{Value: leftVal * rightVal} case tokentype.POW: return &object.Float{Value: math.Pow(leftVal, rightVal)} case tokentype.SLASH: return &object.Float{Value: leftVal / rightVal} case tokentype.SLASH_EQUALS: return &object.Float{Value: leftVal / rightVal} case tokentype.LT: return nativeBoolToBooleanObject(leftVal < rightVal) case tokentype.LT_EQUALS: return nativeBoolToBooleanObject(leftVal <= rightVal) case tokentype.GT: return nativeBoolToBooleanObject(leftVal > rightVal) case tokentype.GT_EQUALS: return nativeBoolToBooleanObject(leftVal >= rightVal) case tokentype.EQ: return nativeBoolToBooleanObject(leftVal == rightVal) case tokentype.NOT_EQ: return nativeBoolToBooleanObject(leftVal != rightVal) default: return object.NewError(node, "unknown operator: %s %s %s", left.Type(), operator.Literal(), right.Type()) } } func evalStringInfixExpression(node asti.NodeI, operator tokentype.TokenType, left, right object.ObjectI) object.ObjectI { l := left.(*object.String) r := right.(*object.String) switch operator { case tokentype.EQ: return nativeBoolToBooleanObject(l.Value == r.Value) case tokentype.NOT_EQ: return nativeBoolToBooleanObject(l.Value != r.Value) case tokentype.GT_EQUALS: return nativeBoolToBooleanObject(l.Value >= r.Value) case tokentype.GT: return nativeBoolToBooleanObject(l.Value > r.Value) case tokentype.LT_EQUALS: return nativeBoolToBooleanObject(l.Value <= r.Value) case tokentype.LT: return nativeBoolToBooleanObject(l.Value < r.Value) case tokentype.PLUS: return &object.String{Value: l.Value + r.Value} case tokentype.PLUS_EQUALS: return &object.String{Value: l.Value + r.Value} } return object.NewError(node, "unknown operator: %s %s %s", left.Type(), operator.Literal(), right.Type()) } // evalIfExpression handles an `if` expression, running the block // if the condition matches, and running any optional else block // otherwise. func evalIfExpression(ie *ast.IfExpression, env *object.Environment) object.ObjectI { // // Create an environment for handling regexps // var permit []string i := 1 for i < 32 { permit = append(permit, fmt.Sprintf("$%d", i)) i++ } nEnv := object.NewTemporaryScope(env, permit) condition := Eval(ie.Condition, nEnv) if object.IsError(condition) { return condition } if isTruthy(condition) { return Eval(ie.Consequence, nEnv) } else if ie.Alternative != nil { return Eval(ie.Alternative, nEnv) } else { return object.NULL } } // evalTernaryExpression handles a ternary-expression. If the condition // is true we return the contents of evaluating the true-branch, otherwise // the false-branch. (Unlike an `if` statement we know that we always have // an alternative/false branch.) func evalTernaryExpression(te *ast.TernaryExpression, env *object.Environment) object.ObjectI { condition := Eval(te.Condition, env) if object.IsError(condition) { return condition } if isTruthy(condition) { return Eval(te.IfTrue, env) } return Eval(te.IfFalse, env) } func evalAssignStatement(a *ast.AssignStatement, env *object.Environment) (val object.ObjectI) { evaluated := Eval(a.Value, env) if object.IsError(evaluated) { return evaluated } // // An assignment is generally: // // variable = value // // But we cheat and reuse the implementation for: // // i += 4 // // In this case we record the "operator" as tokentype.PLUS_EQUALS // switch a.Operator { case tokentype.PLUS_EQUALS: // Get the current value current, ok := env.Get(a.Name.String()) if !ok { return object.NewError(a, "%s is unknown", a.Name.String()) } res := evalInfixExpression(a, tokentype.PLUS_EQUALS, current, evaluated, env) if object.IsError(res) { fmt.Fprintf(os.Stderr, "%v\n", res.Inspect()) return res } env.Set(a.Name.String(), res) return res case tokentype.MINUS_EQUALS: // Get the current value current, ok := env.Get(a.Name.String()) if !ok { return object.NewError(a, "%s is unknown", a.Name.String()) } res := evalInfixExpression(a, tokentype.MINUS_EQUALS, current, evaluated, env) if object.IsError(res) { fmt.Fprintf(os.Stderr, "%v\n", res.Inspect()) return res } env.Set(a.Name.String(), res) return res case tokentype.ASTERISK_EQUALS: // Get the current value current, ok := env.Get(a.Name.String()) if !ok { return object.NewError(a, "%s is unknown", a.Name.String()) } res := evalInfixExpression(a, tokentype.ASTERISK_EQUALS, current, evaluated, env) if object.IsError(res) { fmt.Fprintf(os.Stderr, "%v\n", res.Inspect()) return res } env.Set(a.Name.String(), res) return res case tokentype.SLASH_EQUALS: // Get the current value current, ok := env.Get(a.Name.String()) if !ok { return object.NewError(a, "%s is unknown", a.Name.String()) } res := evalInfixExpression(a, tokentype.SLASH_EQUALS, current, evaluated, env) if object.IsError(res) { fmt.Fprintf(os.Stderr, "%v\n", res.Inspect()) return res } env.Set(a.Name.String(), res) return res case tokentype.ASSIGN: // If we're running with the strict-pragma it is // a bug to set a variable which wasn't declared (via let). if pragmas.PRAGMAS["strict"] == 1 { _, ok := env.Get(a.Name.String()) if !ok { fmt.Fprintf(os.Stderr, "Setting unknown variable '%s' is a bug under strict-pragma! %v\n", a.Name.String(), a) os.Exit(1) } } env.Set(a.Name.String(), evaluated) } return evaluated } func evalSwitchStatement(se *ast.SwitchExpression, env *object.Environment) object.ObjectI { // Get the value. obj := Eval(se.Value, env) // Try all the choices for _, opt := range se.Choices { // skipping the default-case, which we'll // handle later. if opt.Default { continue } // Look at any expression we've got in this case. for _, val := range opt.Expr { // Get the value of the case out := Eval(val, env) // Is it a literal match? if obj.Type() == out.Type() && (obj.Inspect() == out.Inspect()) { // Evaluate the block and return the value out := evalBlockStatement(opt.Block, env) return out } // Is it a regexp-match? if out.Type() == objecttype.REGEXP { m := matches(se, obj, out, env) if m == object.TRUE { // Evaluate the block and return the value out := evalBlockStatement(opt.Block, env) return out } } } } // No match? Handle default if present for _, opt := range se.Choices { // skip default if opt.Default { out := evalBlockStatement(opt.Block, env) return out } } return nil } func evalForLoopExpression(fle *ast.ForLoopExpression, env *object.Environment) object.ObjectI { rt := &object.Boolean{Value: true} for { condition := Eval(fle.Condition, env) if object.IsError(condition) { return condition } if isTruthy(condition) { rt := Eval(fle.Consequence, env) if !object.IsError(rt) && (rt.Type() == objecttype.RETURN_VALUE || rt.Type() == objecttype.ERROR) { return rt } } else { break } } return rt } // handle "for x [,y] in .." func evalForeachExpression(fle *ast.ForeachStatement, env *object.Environment) object.ObjectI { // expression val := Eval(fle.Value, env) helper, ok := val.(object.IterableI) if !ok { return object.NewError(fle, "%s object doesn't implement the Iterable interface", val.Type()) } // The one/two values we're going to permit var permit []string permit = append(permit, fle.Ident) if fle.Index != "" { permit = append(permit, fle.Index) } // Create a new environment for the block // // This will allow writing EVERYTHING to the parent scope, // except the two variables named in the permit-array child := object.NewTemporaryScope(env, permit) // Reset the state of any previous iteration. helper.Reset() // Get the initial values. ret, idx, ok := helper.Next() for ok { // Set the index + name child.Set(fle.Ident, ret) idxName := fle.Index if idxName != "" { child.Set(fle.Index, idx) } // Eval the block rt := Eval(fle.Body, child) // // If we got an error/return then we handle it. // if !object.IsError(rt) && (rt.Type() == objecttype.RETURN_VALUE || rt.Type() == objecttype.ERROR) { return rt } // Loop again ret, idx, ok = helper.Next() } return &object.Null{} } func isTruthy(obj object.ObjectI) bool { switch obj { case object.NULL: return false case object.TRUE: return true case object.FALSE: return false default: return true } } func evalProgram(program *ast.Program, env *object.Environment) object.ObjectI { var result object.ObjectI for _, statement := range program.Statements { result = Eval(statement, env) switch result := result.(type) { case *object.ReturnValue: return result.Value case *object.Error: return result } } return result } func evalIdentifier(node *ast.Identifier, env *object.Environment) object.ObjectI { if val, ok := env.Get(node.Value); ok { return val } if builtin, ok := builtinfunctions.BuiltinFunctions[node.Value]; ok { return builtin } fmt.Fprintf(os.Stderr, "identifier not found: %v\n", node.Token) if pragmas.PRAGMAS["strict"] == 1 { os.Exit(1) } return object.NewError(node, "identifier not found: "+node.Value) } func evalExpression(exps []asti.ExpressionI, env *object.Environment) []object.ObjectI { var result []object.ObjectI for _, e := range exps { evaluated := Eval(e, env) if object.IsError(evaluated) { return []object.ObjectI{evaluated} } result = append(result, evaluated) } return result } // Split a line of text into tokens, but keep anything "quoted" // together.. // // So this input: // // /bin/sh -c "ls /etc" // // Would give output of the form: // /bin/sh // -c // ls /etc // func splitCommand(input string) []string { // // This does the split into an array // r := regexp.MustCompile(`[^\s"']+|"([^"]*)"|'([^']*)`) res := r.FindAllString(input, -1) // // However the resulting pieces might be quoted. // So we have to remove them, if present. // var result []string for _, e := range res { result = append(result, trimQuotes(e, '"')) } return (result) } // Remove balanced characters around a string. func trimQuotes(in string, c byte) string { if len(in) >= 2 { if in[0] == c && in[len(in)-1] == c { return in[1 : len(in)-1] } } return in } // Run a command and return a hash containing the result. // `stderr`, `stdout`, and `error` will be the fields func backTickOperation(command string) object.ObjectI { // split the command toExec := splitCommand(command) cmd := exec.Command(toExec[0], toExec[1:]...) // get the result var outb, errb bytes.Buffer cmd.Stdout = &outb cmd.Stderr = &errb err := cmd.Run() // If the command exits with a non-zero exit-code it // is regarded as a failure. Here we test for ExitError // to regard that as a non-failure. if err != nil && err != err.(*exec.ExitError) { fmt.Fprintf(os.Stderr, "Failed to run '%s' -> %s\n", command, err.Error()) return object.NULL } // // The result-objects to store in our hash. // stdout := &object.String{Value: outb.String()} stderr := &object.String{Value: errb.String()} // Create keys stdoutKey := &object.String{Value: "stdout"} stdoutHash := object.HashPair{Key: stdoutKey, Value: stdout} stderrKey := &object.String{Value: "stderr"} stderrHash := object.HashPair{Key: stderrKey, Value: stderr} // Make a new hash, and populate it newHash := make(map[object.HashKey]object.HashPair) newHash[stdoutKey.HashKey()] = stdoutHash newHash[stderrKey.HashKey()] = stderrHash return &object.Hash{Pairs: newHash} } func evalIndexExpression(node asti.NodeI, left, index object.ObjectI) object.ObjectI { switch { case left.Type() == objecttype.ARRAY && index.Type() == objecttype.INTEGER: return evalArrayIndexExpression(left, index) case left.Type() == objecttype.HASH: return evalHashIndexExpression(node, left, index) case left.Type() == objecttype.STRING: return evalStringIndexExpression(left, index) default: return object.NewError(node, "index operator not support:%s", left.Type()) } } func evalArrayIndexExpression(array, index object.ObjectI) object.ObjectI { arrayObject := array.(*object.Array) idx := index.(*object.Integer).Value max := int64(len(arrayObject.Elements) - 1) if idx < 0 || idx > max { return object.NULL } return arrayObject.Elements[idx] } func evalHashIndexExpression(node asti.NodeI, hash, index object.ObjectI) object.ObjectI { hashObject := hash.(*object.Hash) key, ok := index.(object.HashableI) if !ok { return object.NewError(node, "unusable as hash key: %s", index.Type()) } pair, ok := hashObject.Pairs[key.HashKey()] if !ok { return object.NULL } return pair.Value } func evalStringIndexExpression(input, index object.ObjectI) object.ObjectI { str := input.(*object.String).Value idx := index.(*object.Integer).Value max := int64(len(str)) if idx < 0 || idx > max { return object.NULL } // Get the characters as an array of runes chars := []rune(str) // Now index ret := chars[idx] // And return as a string. return &object.String{Value: string(ret)} } func evalHashLiteral(node *ast.HashLiteral, env *object.Environment) object.ObjectI { pairs := make(map[object.HashKey]object.HashPair) for keyNode, valueNode := range node.Pairs { key := Eval(keyNode, env) if object.IsError(key) { return key } hashKey, ok := key.(object.HashableI) if !ok { return object.NewError(node, "unusable as hash key: %s", key.Type()) } value := Eval(valueNode, env) if object.IsError(value) { return value } hashed := hashKey.HashKey() pairs[hashed] = object.HashPair{Key: key, Value: value} } return &object.Hash{Pairs: pairs} } func applyFunction(node asti.NodeI, env *object.Environment, fn object.ObjectI, args []object.ObjectI) object.ObjectI { switch fn := fn.(type) { case *object.Function: extendEnv := extendFunctionEnv(fn, args) evaluated := Eval(fn.Body, extendEnv) return upwrapReturnValue(evaluated) case *object.Builtin: return fn.Fn(node, env, args...) default: return object.NewError(node, "not a function: %s", fn.Type()) } } func extendFunctionEnv(fn *object.Function, args []object.ObjectI) *object.Environment { env := object.NewEnclosedEnvironment(fn.Env) // Set the defaults for key, val := range fn.Defaults { env.Set(key, Eval(val, env)) } for paramIdx, param := range fn.Parameters { if paramIdx < len(args) { env.Set(param.Value, args[paramIdx]) } } return env } func upwrapReturnValue(obj object.ObjectI) object.ObjectI { if returnValue, ok := obj.(*object.ReturnValue); ok { return returnValue.Value } return obj } // evalObjectCallExpression invokes methods against objects. func evalObjectCallExpression(call *ast.ObjectCallExpression, env *object.Environment) object.ObjectI { obj := Eval(call.Object, env) if method, ok := call.Call.(*ast.CallExpression); ok { // // Here we try to invoke the object.method() call which has // been implemented in go. // // We do this by forwarding the call to the appropriate // `invokeMethod` interface on the object. // args := evalExpression(call.Call.(*ast.CallExpression).Arguments, env) ret := obj.InvokeMethod(method.Function.String(), *env, args...) if ret != nil { return ret } // // If we reach this point then the invokation didn't // succeed, that probably means that the function wasn't // implemented in go. // // So now we want to look for it in monkey, and we have // enough details to find the appropriate function. // // * We have the object involved. // // * We have the type of that object. // // * We have the name of the function. // // * We have the arguments. // // We'll use the type + name to lookup the (global) function // to invoke. For example in this case we'll invoke // `string.len()` - because the type of the object we're // invoking-against is string: // // "steve".len(); // // For this case we'll be looking for `array.foo()`. // // let a = [ 1, 2, 3 ]; // puts( a.foo() ); // // As a final fall-back we'll look for "object.foo()" // if "array.foo()" isn't defined. // // // attempts := []string{} attempts = append(attempts, strings.ToLower(string(obj.Type()))) attempts = append(attempts, "object") // // Look for "$type.name", or "object.name" // for _, prefix := range attempts { // // What we're attempting to execute. // name := prefix + "." + method.Function.String() // // Try to find that function in our environment. // if fn, ok := env.Get(name); ok { // // Extend our environment with the functional-args. // extendEnv := extendFunctionEnv(fn.(*object.Function), args) // // Now set "self" to be the implicit object, against // which the function-call will be operating. // extendEnv.Set("self", obj) // // Finally invoke & return. // evaluated := Eval(fn.(*object.Function).Body, extendEnv) obj = upwrapReturnValue(evaluated) return obj } else { //fmt.Fprintf(os.Stderr,"fail to exec %v %v\n", name, env) } } } // // If we hit this point we have had a method invoked which // was neither defined in go nor monkey. // // e.g. "steve".md5sum() // // So we've got no choice but to return an error. // return object.NewError(call, "Failed to invoke method: %s", call.Call.(*ast.CallExpression).Function.String()) } func objectToNativeBoolean(o object.ObjectI) bool { if r, ok := o.(*object.ReturnValue); ok { o = r.Value } switch obj := o.(type) { case *object.Boolean: return obj.Value case *object.String: return obj.Value != "" case *object.Regexp: return obj.Value != "" case *object.Null: return false case *object.Integer: if obj.Value == 0 { return false } return true case *object.Float: if obj.Value == 0.0 { return false } return true case *object.Array: if len(obj.Elements) == 0 { return false } return true case *object.Hash: if len(obj.Pairs) == 0 { return false } return true default: return true } }
package main import ( "github.com/hardstylez72/bblog/internal/auth" "github.com/hardstylez72/bblog/internal/objectstorage" "github.com/spf13/viper" ) const ( cfgAllData = "" ) type Config struct { Port string Env string Host string Oauth auth.Oauth Databases Databases ObjectStorage SessionCookie auth.SessionCookieConfig } type ObjectStorage struct { Minio objectstorage.Config } type Databases struct { Postgres string } func Load(filePath string) error { viper.SetConfigFile(filePath) err := viper.ReadInConfig() // Find and read the config file if err != nil { // Handle errors reading the config file return err } return nil }
package epistoli import ( "encoding/json" "errors" "io" "net/http" "net/url" "os" "strings" "time" "github.com/oz/miniporte/link" ) const ( // ServiceName is this package's pretty name. ServiceName = "epistoli" // APIURL is the base API endpoint for Epistoli. APIURL = "https://episto.li/api/v1" // HTTPTimeout specifies how many seconds we wait for the API to answer. HTTPTimeout = 3 ) // Epistoli base type: just enough to satisfy the link.Service // interface. type Epistoli struct { Letter string client *http.Client } type response struct { Ok bool `json:"ok"` Err string `json:"error"` // And other stuff we don't care about ATM... } // New initialize an Epistoli service. func New() *Epistoli { return &Epistoli{ Letter: os.Getenv("EPISTOLI_LETTER"), client: &http.Client{ Timeout: HTTPTimeout * time.Second, Transport: &http.Transport{DisableKeepAlives: true}, }, } } func (e *Epistoli) String() string { return ServiceName } // Save a Link to Epistoli func (e *Epistoli) Save(l *link.Link) (err error) { params := e.postParams(l) postURL := APIURL + "/bookmarks" req, err := http.NewRequest("POST", postURL, params) if err != nil { return } token, err := authToken() if err != nil { return } req.Header.Add("Accept", "application/json") req.Header.Add("X-Token", token) req.Header.Add("User-Agent", link.UserAgent) req.Header.Add("Content-Type", "application/x-www-form-urlencoded") if resp, err := e.client.Do(req); err == nil { return parseResponse(resp) } return } func parseResponse(resp *http.Response) error { defer resp.Body.Close() d := json.NewDecoder(resp.Body) jsonRes := response{} err := d.Decode(&jsonRes) // Request error? if err != nil { return err } // Epistoli error? if !jsonRes.Ok { return errors.New(jsonRes.Err) } // All good. return nil } // Check the docs at: https://github.com/Epistoli/apidocs func (e *Epistoli) postParams(l *link.Link) io.Reader { form := url.Values{} form.Set("url", l.Url) form.Set("newsletter_id", e.Letter) form.Set("tags", strings.Join(l.Tags, ",")) return strings.NewReader(form.Encode()) } func authToken() (string, error) { token := os.Getenv("EPISTOLI_TOKEN") if token == "" { return "", errors.New("Missing Epistoli Token") } return token, nil }
/* Copyright 2019 The Knative Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package v1alpha1 import ( appsv1 "k8s.io/api/apps/v1" "knative.dev/eventing/pkg/apis/duck" "knative.dev/pkg/apis" ) const ( // KogitoConditionReady has status True when the KogitoSource is ready to send events. KogitoConditionReady = apis.ConditionReady // KogitoConditionSinkProvided has status True when the KogitoSource has been configured with a sink target. KogitoConditionSinkProvided apis.ConditionType = "SinkProvided" // KogitoConditionDeployed has status True when the KogitoSource has had it's deployment created. KogitoConditionDeployed apis.ConditionType = "Deployed" ) var KogitoCondSet = apis.NewLivingConditionSet( KogitoConditionSinkProvided, KogitoConditionDeployed, ) // GetCondition returns the condition currently associated with the given type, or nil. func (s *KogitoSourceStatus) GetCondition(t apis.ConditionType) *apis.Condition { return KogitoCondSet.Manage(s).GetCondition(t) } // InitializeConditions sets relevant unset conditions to Unknown state. func (s *KogitoSourceStatus) InitializeConditions() { KogitoCondSet.Manage(s).InitializeConditions() } // GetConditionSet returns KogitoSource ConditionSet. func (*KogitoSource) GetConditionSet() apis.ConditionSet { return KogitoCondSet } // MarkSink sets the condition that the source has a sink configured. func (s *KogitoSourceStatus) MarkSink(uri *apis.URL) { s.SinkURI = uri if len(uri.String()) > 0 { KogitoCondSet.Manage(s).MarkTrue(KogitoConditionSinkProvided) } else { KogitoCondSet.Manage(s).MarkUnknown(KogitoConditionSinkProvided, "SinkEmpty", "Sink has resolved to empty.") } } // MarkNoSink sets the condition that the source does not have a sink configured. func (s *KogitoSourceStatus) MarkNoSink(reason, messageFormat string, messageA ...interface{}) { s.SinkURI = nil KogitoCondSet.Manage(s).MarkFalse(KogitoConditionSinkProvided, reason, messageFormat, messageA...) } // PropagateDeploymentAvailability uses the availability of the provided Deployment to determine if // KogitoConditionDeployed should be marked as true or false. func (s *KogitoSourceStatus) PropagateDeploymentAvailability(d *appsv1.Deployment) { if duck.DeploymentIsAvailable(&d.Status, false) { KogitoCondSet.Manage(s).MarkTrue(KogitoConditionDeployed) } else { // I don't know how to propagate the status well, so just give the name of the Deployment // for now. KogitoCondSet.Manage(s).MarkFalse(KogitoConditionDeployed, "KogitoRuntimeUnavailable", "The KogitoRuntime '%s' is unavailable.", d.Name) } } // IsReady returns true if the resource is ready overall. func (s *KogitoSourceStatus) IsReady() bool { return KogitoCondSet.Manage(s).IsHappy() }
/* Copyright 2021 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package diffstore import ( "fmt" "github.com/cespare/xxhash" ) func ExampleDiffStore() { s := New() set := func(k, v string) { fmt.Printf("set %v to %s\n", k, v) s.Set([]byte(k), xxhash.Sum64([]byte(v)), v) } set("a", "alice") set("b", "bob") fmt.Println("-> updated:", s.Updated(), "deleted:", s.Deleted()) // -------------------------------------------------------------------------- fmt.Println() s.Reset(ItemUnchanged) set("a", "alice2") fmt.Println("-> updated:", s.Updated(), "deleted:", s.Deleted()) // -------------------------------------------------------------------------- fmt.Println() s.Reset(ItemDeleted) set("a", "alice3") fmt.Println("-> updated:", s.Updated(), "deleted:", s.Deleted()) // -------------------------------------------------------------------------- fmt.Println() s.Reset(ItemDeleted) set("a", "alice3") set("b", "bob") fmt.Println("-> updated:", s.Updated(), "deleted:", s.Deleted()) // double reset will remove all entries (and should not crash) s.Reset(ItemDeleted) s.Reset(ItemDeleted) fmt.Println("tree size after double reset:", s.tree.Len()) // Output: // set a to alice // set b to bob // -> updated: [{[97] alice} {[98] bob}] deleted: [] // // set a to alice2 // -> updated: [{[97] alice2}] deleted: [] // // set a to alice3 // -> updated: [{[97] alice3}] deleted: [{[98] <nil>}] // // set a to alice3 // set b to bob // -> updated: [{[98] bob}] deleted: [] // tree size after double reset: 0 }
package main import ( "fmt" "strconv" ) func main() { n := 103456789 numStr := strconv.Itoa(n) isNonZero := false for i := len(numStr) - 1; i >= 0; i-- { if isNonZero && string(numStr[i]) == "0" { fmt.Println("true") return } if string(numStr[i]) != "0" { isNonZero = true } } fmt.Println("false") }
package marathon import ( "encoding/json" "io/ioutil" "net/http" ) // Error is a trivial implementation of error type Error struct { message string `json:"message"` } // Error returns the description of the error func (e *Error) Error() string { return e.message } func parseError(resp *http.Response) error { b, err := ioutil.ReadAll(resp.Body) if err != nil { return err } err = &Error{} if err := json.Unmarshal(b, err); err != nil { return err } return err }
package main import "fmt" func main() { var str1 string //声明变量 str1 = "abc" //赋值 fmt.Println(str1) //自动推导类型 str2 := "知了课堂" fmt.Println(str2) fmt.Printf("%T\n",str2) //ch := 'a' //str := "a" //'a''\0' 字符串结束标志 //len函数 计算字符串中字符的个数 不包含\0 //在go语言中 一个汉字占3个字符 fmt.Println(len(str2)) //字符串拼接 + str3 := "hello" str4 := "知了课堂" str5 := str4+str3 fmt.Println(str5) }
/* * @lc app=leetcode.cn id=1436 lang=golang * * [1436] 旅行终点站 */ // @lc code=start package main func destCity(paths [][]string) string { pathMap := make(map[string]bool) for i := 0; i < len(paths); i++ { pathMap[paths[i][0]] = true } for _, path := range paths { if !pathMap[path[1]] { return path[1] } } return "" } // @lc code=end
package main import ( "log" "math" ) //链表实现多项式的求和.本来是做多项式求和的,这里写的是指数式求和 type PNode struct{ coef float64 expn float64 belong *PolymomialList next *PNode } type PolymomialList struct{ root PNode length int last *PNode } func (l *PolymomialList)Init() *PolymomialList{ l.length = 0 l.root.next = nil l.last = &l.root return l } func NewPolynomialList() *PolymomialList{ return new(PolymomialList).Init() } func NewPNode(coef float64,expn float64)*PNode{ return &PNode{coef:coef,expn:expn} } func (l *PolymomialList)AddNode(n *PNode)*PolymomialList{ l.last.next = n n.belong = l l.length++ l.last = n return l } func (l *PolymomialList)Sum() float64{ sum := 0.0 if l.length == 0{ return 0 } n := l.root.next for n != nil{ sum += math.Pow(n.coef,n.expn) n = n.next } return sum } func main(){ l := NewPolynomialList() pa := NewPNode(3,2) pb := NewPNode(3,3) pc := NewPNode(2,4) pd := NewPNode(1,1) l.AddNode(pa).AddNode(pb).AddNode(pc).AddNode(pd) log.Println(l.Sum()) }
package ghosts type Ghost interface { Name() string Evidence() [3]string }
package tfc import ( "testing" tfcPb "github.com/stefanprisca/strategy-protobufs/tfc" "github.com/stretchr/testify/require" ) func TestGenerateGameBoard(t *testing.T) { gb, err := NewGameBoard() require.NoError(t, err) assertGameBoard(t, *gb) // boardPrettyString := prettyprint.NewTFCBoardCanvas(). // PrettyPrintTfcBoard(*gb) // fmt.Println(boardPrettyString) } func assertGameBoard(t *testing.T, gb tfcPb.GameBoard) { require.NotZero(t, len(gb.Intersections), "expected to have intersections initialized") require.NotZero(t, len(gb.Edges), "expected to have edges initialized") require.NotZero(t, len(gb.Tiles), "expected to have tiles initialized") for _, I := range gb.Intersections { require.NotNil(t, I.Id, "expected intersection ID for %v", I) require.NotNil(t, I.Attributes, "expected intersection attributes for %v", I) require.NotNil(t, I.Coordinates, "expected intersection coordinates for %v", I) require.NotNil(t, I.IncidentEdge, "expected intersection incident edge for %v", I) } for _, E := range gb.Edges { require.NotNil(t, E.Id, "expected edge ID for %v", E) require.NotNil(t, E.Attributes, "expected edge coordinates for %v", E) require.NotNil(t, E.Origin, "expected edge origin for %v", E) require.NotNil(t, E.Next, "expected edge next pointer for %v", E) require.NotNil(t, E.Prev, "expected edge prev pointer for %v", E) require.NotNil(t, E.IncidentTile, "expected edge tile for %v", E) if E.GetTwin() != 0 { twin := gb.Edges[E.GetTwin()] require.Equal(t, E.GetId(), twin.GetTwin(), "expected twin edge to point back for %v:\n\t got %v", E, twin) } } for _, T := range gb.Tiles { require.NotNil(t, T.GetAttributes(), "expected tile to have attributes") require.NotZero(t, T.GetOuterComponent(), "expected tile to have outer component") outerCompID := T.GetOuterComponent() outerComp := gb.Edges[outerCompID] require.Equal(t, outerComp.IncidentTile, T.Id, "expected outer component to point back to tile for %v:\n\t got %v", T, outerComp) } }
package api import ( "dingtalk/model" "encoding/json" "errors" "fmt" "net/url" "strconv" "github.com/jinzhu/copier" ) // DingUser dingding user type DingUser struct { Tocken string `json:"tocken" yaml:"tocken"` // 应用访问tocken BaseURL string `json:"base_url" yaml:"base_url"` // 接口地址:https://oapi.dingtalk.com } // NewDingUser get DingUser object func NewDingUser(baseURL string, tocken string) *DingUser { return &DingUser{ BaseURL: baseURL, Tocken: tocken, } } // Detail 获取用户详情 // id 部门id func (s *DingUser) Detail(userid string, lang *string) (*model.UserRoles, error) { var detail model.UserRoles apiURL := s.BaseURL + "/user/get?" query := url.Values{} query.Set("access_token", s.Tocken) query.Set("userid", userid) if lang != nil { query.Set("lang", *lang) } apiURL += query.Encode() fmt.Println(apiURL) body, err := Get(apiURL) if err != nil { return nil, err } result := struct { ErrCode int `json:"errcode"` ErrMsg string `json:"errmsg"` model.UserDetail }{} if err := json.Unmarshal(body.([]byte), &result); err != nil { return nil, err } if result.ErrCode > 0 { return nil, errors.New(result.ErrMsg) } copier.Copy(&detail, &result) return &detail, nil } // GetDeptMember 获取部门用户userid列表 // deptId 部门id func (s *DingUser) GetDeptMember(deptID string) ([]string, error) { apiURL := s.BaseURL + "/user/getDeptMember?" query := url.Values{} query.Set("access_token", s.Tocken) query.Set("deptId", deptID) apiURL += query.Encode() fmt.Println(apiURL) body, err := Get(apiURL) if err != nil { return nil, err } result := struct { ErrCode int `json:"errcode"` ErrMsg string `json:"errmsg"` Items []string `json:"userIds"` }{} if err := json.Unmarshal(body.([]byte), &result); err != nil { return nil, err } if result.ErrCode > 0 { return nil, errors.New(result.ErrMsg) } return result.Items, nil } // Simplelist 获取部门用户 // deptID 获取的部门id // lang 通讯录语言(默认zh_CN另外支持en_US) // offset 支持分页查询,与size参数同时设置时才生效,此参数代表偏移量 // size 支持分页查询,与offset参数同时设置时才生效,此参数代表分页大小,最大100 // order 支持分页查询,部门成员的排序规则,默认不传是按自定义排序; // entry_asc:代表按照进入部门的时间升序, // entry_desc:代表按照进入部门的时间降序, // modify_asc:代表按照部门信息修改时间升序, // modify_desc:代表按照部门信息修改时间降序, // custom:代表用户定义(未定义时按照拼音)排序 func (s *DingUser) Simplelist(deptID int64, lang *string, offset *int64, size *int64, order *string) (*model.UserItemsList, error) { var list model.UserItemsList apiURL := s.BaseURL + "/user/simplelist?" query := url.Values{} query.Set("access_token", s.Tocken) query.Set("department_id", strconv.FormatInt(deptID, 10)) if lang != nil { query.Set("lang", *lang) } if lang != nil { query.Set("offset", strconv.FormatInt(*offset, 10)) } if offset != nil { query.Set("size", strconv.FormatInt(*offset, 10)) } if size != nil { query.Set("size", strconv.FormatInt(*size, 10)) } if order != nil { query.Set("order", *order) } apiURL += query.Encode() fmt.Println(apiURL) body, err := Get(apiURL) if err != nil { return nil, err } result := struct { ErrCode int `json:"errcode"` ErrMsg string `json:"errmsg"` model.UserItemsList }{} if err := json.Unmarshal(body.([]byte), &result); err != nil { return nil, err } if result.ErrCode > 0 { return nil, errors.New(result.ErrMsg) } copier.Copy(&list, &result) return &list, nil } // ListByPage 获取部门用户详情 // deptID 获取的部门id // lang 通讯录语言(默认zh_CN另外支持en_US) // offset 支持分页查询,与size参数同时设置时才生效,此参数代表偏移量 // size 支持分页查询,与offset参数同时设置时才生效,此参数代表分页大小,最大100 // order 支持分页查询,部门成员的排序规则,默认不传是按自定义排序; // entry_asc:代表按照进入部门的时间升序, // entry_desc:代表按照进入部门的时间降序, // modify_asc:代表按照部门信息修改时间升序, // modify_desc:代表按照部门信息修改时间降序, // custom:代表用户定义(未定义时按照拼音)排序 func (s *DingUser) ListByPage(deptID int64, lang *string, offset int64, size int64, order *string) (*model.UserDetailList, error) { var list model.UserDetailList apiURL := s.BaseURL + "/user/listbypage?" query := url.Values{} query.Set("access_token", s.Tocken) query.Set("department_id", strconv.FormatInt(deptID, 10)) query.Set("offset", strconv.FormatInt(offset, 10)) query.Set("size", strconv.FormatInt(offset, 10)) query.Set("size", strconv.FormatInt(size, 10)) if lang != nil { query.Set("lang", *lang) } if order != nil { query.Set("order", *order) } apiURL += query.Encode() fmt.Println(apiURL) body, err := Get(apiURL) if err != nil { return nil, err } result := struct { ErrCode int `json:"errcode"` ErrMsg string `json:"errmsg"` model.UserDetailList }{} if err := json.Unmarshal(body.([]byte), &result); err != nil { return nil, err } if result.ErrCode > 0 { return nil, errors.New(result.ErrMsg) } copier.Copy(&list, &result) return &list, nil } // GetAdmin 获取管理员列表 func (s *DingUser) GetAdmin() ([]*model.AdminItem, error) { apiURL := s.BaseURL + "/user/get_admin?" query := url.Values{} query.Set("access_token", s.Tocken) apiURL += query.Encode() fmt.Println(apiURL) body, err := Get(apiURL) if err != nil { return nil, err } result := struct { ErrCode int `json:"errcode"` ErrMsg string `json:"errmsg"` Items []*model.AdminItem `json:"admin_list"` }{} if err := json.Unmarshal(body.([]byte), &result); err != nil { return nil, err } if result.ErrCode > 0 { return nil, errors.New(result.ErrMsg) } return result.Items, nil } // GetAdminScope 获取管理员通讯录权限范围 // userid 员工id func (s *DingUser) GetAdminScope(userid string) ([]int64, error) { apiURL := s.BaseURL + "/topapi/user/get_admin_scope?" query := url.Values{} query.Set("access_token", s.Tocken) query.Set("userid", userid) apiURL += query.Encode() fmt.Println(apiURL) body, err := Get(apiURL) if err != nil { return nil, err } result := struct { ErrCode int `json:"errcode"` ErrMsg string `json:"errmsg"` Items []int64 `json:"dept_ids"` // 可管理的部门id列表 }{} if err := json.Unmarshal(body.([]byte), &result); err != nil { return nil, err } if result.ErrCode > 0 { return nil, errors.New(result.ErrMsg) } return result.Items, nil } // GetUseridByUnionid 根据unionid获取userid // unionid 员工在当前开发者企业账号范围内的唯一标识,系统生成,固定值,不会改变 func (s *DingUser) GetUseridByUnionid(unionid string) (int, string, error) { apiURL := s.BaseURL + "/user/getUseridByUnionid?" query := url.Values{} query.Set("access_token", s.Tocken) query.Set("unionid", unionid) apiURL += query.Encode() fmt.Println(apiURL) body, err := Get(apiURL) if err != nil { return 0, "", err } result := struct { ErrCode int `json:"errcode"` ErrMsg string `json:"errmsg"` ContactType int `json:"contactType"` // 联系类型,0表示企业内部员工,1表示企业外部联系人 UserID string `json:"userid"` // 员工id }{} if err := json.Unmarshal(body.([]byte), &result); err != nil { return 0, "", err } if result.ErrCode > 0 { return 0, "", errors.New(result.ErrMsg) } return result.ContactType, result.UserID, nil } // GetByMobile 根据手机号获取userid // mobile 手机号码 func (s *DingUser) GetByMobile(mobile string) (string, error) { apiURL := s.BaseURL + "/user/get_by_mobile?" query := url.Values{} query.Set("access_token", s.Tocken) query.Set("mobile", mobile) apiURL += query.Encode() fmt.Println(apiURL) body, err := Get(apiURL) if err != nil { return "", err } result := struct { ErrCode int `json:"errcode"` ErrMsg string `json:"errmsg"` UserID string `json:"userid"` // 员工在当前企业内的唯一标识。 }{} if err := json.Unmarshal(body.([]byte), &result); err != nil { return "", err } if result.ErrCode > 0 { return "", errors.New(result.ErrMsg) } return result.UserID, nil } // GetOrgUserCount 获取企业员工人数 // onlyActive 0:包含未激活钉钉的人员数量; 1:不包含未激活钉钉的人员数量 func (s *DingUser) GetOrgUserCount(onlyActive int) (int, error) { apiURL := s.BaseURL + "/user/get_org_user_count?" query := url.Values{} query.Set("access_token", s.Tocken) query.Set("onlyActive", strconv.Itoa(onlyActive)) apiURL += query.Encode() fmt.Println(apiURL) body, err := Get(apiURL) if err != nil { return 0, err } result := struct { ErrCode int `json:"errcode"` ErrMsg string `json:"errmsg"` Count int `json:"count"` // 企业员工数量 }{} if err := json.Unmarshal(body.([]byte), &result); err != nil { return 0, err } if result.ErrCode > 0 { return 0, errors.New(result.ErrMsg) } return result.Count, nil } // PostInactiveList 未登录钉钉的员工列表 // queryDate 查询日期: 20190808 // offset 分页数据偏移量,从0开始 // size 每页大小,最大100 func (s *DingUser) PostInactiveList(queryDate string, offset int, size int) (bool, []string, error) { apiURL := s.BaseURL + "/topapi/inactive/user/get?" query := url.Values{} query.Set("access_token", s.Tocken) query.Set("query_date", queryDate) query.Set("offset", strconv.Itoa(offset)) query.Set("size", strconv.Itoa(size)) apiURL += query.Encode() fmt.Println(apiURL) body, err := Post(apiURL, []byte{}) if err != nil { return false, []string{}, err } result := struct { ErrCode int `json:"errcode"` ErrMsg string `json:"errmsg"` Result struct { HasMore bool `json:"has_more"` // 是否还有更多数据 List []string `json:"list"` // 未登录用户userId列表 } `json:"result"` }{} if err := json.Unmarshal(body.([]byte), &result); err != nil { return false, []string{}, err } if result.ErrCode > 0 { return false, []string{}, errors.New(result.ErrMsg) } return result.Result.HasMore, result.Result.List, nil } // Delete 删除用户 // userid 员工id func (s *DingUser) Delete(userid string) error { apiURL := s.BaseURL + "/user/delete?" query := url.Values{} query.Set("access_token", s.Tocken) query.Set("userid", userid) apiURL += query.Encode() fmt.Println(apiURL) body, err := Get(apiURL) if err != nil { return err } result := struct { ErrCode int `json:"errcode"` ErrMsg string `json:"errmsg"` }{} if err := json.Unmarshal(body.([]byte), &result); err != nil { return err } if result.ErrCode > 0 { return errors.New(result.ErrMsg) } return nil } // Update 更新用户 func (s *DingUser) Update(user *model.User) error { apiURL := s.BaseURL + "/user/update?" query := url.Values{} query.Set("access_token", s.Tocken) apiURL += query.Encode() fmt.Println(apiURL) bs, err := json.Marshal(user) if err != nil { return err } body, err := Post(apiURL, bs) if err != nil { return err } result := struct { ErrCode int `json:"errcode"` ErrMsg string `json:"errmsg"` Result struct { HasMore bool `json:"has_more"` // 是否还有更多数据 List []string `json:"list"` // 未登录用户userId列表 } `json:"result"` }{} if err := json.Unmarshal(body.([]byte), &result); err != nil { return err } if result.ErrCode > 0 { return errors.New(result.ErrMsg) } return nil } // Create 创建用户 func (s *DingUser) Create(user *model.User) error { apiURL := s.BaseURL + "/user/create?" query := url.Values{} query.Set("access_token", s.Tocken) apiURL += query.Encode() fmt.Println(apiURL) bs, err := json.Marshal(user) if err != nil { return err } body, err := Post(apiURL, bs) if err != nil { return err } result := struct { ErrCode int `json:"errcode"` ErrMsg string `json:"errmsg"` Result struct { HasMore bool `json:"has_more"` // 是否还有更多数据 List []string `json:"list"` // 未登录用户userId列表 } `json:"result"` }{} if err := json.Unmarshal(body.([]byte), &result); err != nil { return err } if result.ErrCode > 0 { return errors.New(result.ErrMsg) } return nil }
package msgs type Handler interface { Handle(Message) error } type HandlerFunc func(Message) error func (hf HandlerFunc) Handle(msg Message) error { return hf(msg) }
/* * SMA WebBox RPC over HTTP REST API * * The data loggers Sunny WebBox and Sunny WebBox with Bluetooth continuously record all the data of a PV plant. This is then averaged over a configurable interval and cached. The data can be transmitted at regular intervals to the Sunny Portal for analysis and visualization. Via the Sunny WebBox and Sunny WebBox with Bluetooth RPC interface, selected data from the PV plant can be transmitted to a remote terminal by means of an RPC protocol (Remote Procedure Call protocol). Related documents: * [SUNNY WEBBOX RPC User Manual v1.4](http://files.sma.de/dl/2585/SWebBoxRPC-BA-en-14.pdf) * [SUNNY WEBBOX RPC User Manual v1.3](http://files.sma.de/dl/4253/SWebBoxRPC-eng-BUS112713.pdf) * * API version: 1.4.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package smawebboxgo type Device struct { // A unique device key (e.g. \"SB21TL06:2000106925\"). Key string `json:"key,omitempty"` // The user-definable name of the device (e.g. \"INV left\"). Defining this element is optional. If the element is used but no name was defined, ```null``` is entered. Name string `json:"name,omitempty"` }
package conf import ( "github.com/pkg/errors" "gopkg.in/yaml.v2" "io/ioutil" "log" ) type Config struct { Env struct { Port int `yaml:"port"` Dir string `yaml:"dir"` Rabbitmq string `yaml:"rabbitmq"` } `yaml:"env"` } var conf Config func InitConfig() error { yamlFile,err := ioutil.ReadFile("depoly/config.yaml") if err!=nil{ err = errors.Wrap(err,"read config file failed.") return err } err = yaml.Unmarshal(yamlFile,&conf) if err!=nil{ err = errors.Wrap(err, "Unmarshal config file failed.") return err } log.Print(conf) return nil } func GetConfig() Config{ return conf }
package ast import ( "bytes" "fmt" "strings" "github.com/axbarsan/doggo/internal/token" ) type MapLiteral struct { Token token.Token // The 'token.LBRACE' token. Pairs map[Expression]Expression } func (ml *MapLiteral) expressionNode() {} func (ml *MapLiteral) TokenLiteral() string { return ml.Token.Literal } func (ml *MapLiteral) String() string { var out bytes.Buffer var pairs []string for key, value := range ml.Pairs { pairs = append(pairs, fmt.Sprintf("%s:%s", key.String(), value.String())) } out.WriteString("{") out.WriteString(strings.Join(pairs, ", ")) out.WriteString("}") return out.String() }
package model import ( "net/http" "time" ) type HttpTestCase struct { Name string Method string Path string Input []byte Output []byte Status int Client http.Client Timeout time.Duration }
package user import ( "context" "log" "github.com/MuhammadChandra19/go-grpc-chat/internal/errors" "github.com/MuhammadChandra19/go-grpc-chat/internal/storage" ) type User struct { Username string `json:"username" db:"username"` Name string `json:"name" db:"name"` Email string `json:"email" db:"email"` PhotoURL string `json:"photoUrl" db:"photo_url"` } type repository struct { db storage.Interface } const ( queryUser = `SELECT email, username, name, photo_url FROM "user"` statementInsertUser = `INSERT INTO "user" (name, email, photo_url, username) values (:name,:email,:photo_url,:username)` statementGetUserByEmail = `SELECT * FROM "user" where email = :email` statementSearchUser = `SELECT * FROM "user" where username like :username or name like :name` ) var ( // ErrDataNotFound error data tidak ditemukan ErrDataNotFound = errors.N(errors.CodeNotFoundError, "no data found") ) type RepositoryInterface interface { InsertUser(ctx context.Context, userModel User) error getByEmail(ctx context.Context, email string) (*User, error) getUserList(ctx context.Context, query string) ([]*User, error) GetOne(ctx context.Context, filter map[string]interface{}) (*User, error) } func (r *repository) InsertUser(ctx context.Context, userModel User) error { err := r.db.Exec(ctx, statementInsertUser, userModel) if err != nil { log.Println("Error: Insert User, ", err) return err } return nil } func (r *repository) GetOne(ctx context.Context, filter map[string]interface{}) (*User, error) { queryParams := r.db.GenerateQueryParams(queryUser, filter, nil) response := User{} err := r.db.Query(ctx, queryParams, filter, &response, false) if err != nil { return nil, err } return &response, nil } func (r *repository) getByEmail(ctx context.Context, email string) (*User, error) { var response *User filter := map[string]interface{}{ "email": email, } queryParams := r.db.GenerateQueryParams(statementGetUserByEmail, filter, nil) err := r.db.Query(ctx, queryParams, filter, &response, false) if err != nil { return nil, err } if response.Email == "" { return nil, ErrDataNotFound } return response, nil } func (r *repository) getUserList(ctx context.Context, query string) ([]*User, error) { var response []*User filter := map[string]interface{}{ "username": query, "name": query, } queryParams := r.db.GenerateQueryParams(queryUser, nil, filter) err := r.db.Query(ctx, queryParams, filter, &response, false) if err != nil { return nil, err } if len(response) == 0 { return nil, ErrUserNotFound } return response, nil } func NewRepository(data storage.Interface) RepositoryInterface { return &repository{ db: data, } }
package main import ( "fmt" "github.com/IngridCBarbosa/area" ) func main() { fmt.Println(area.Circ(6.0)) fmt.Println(area.Rect(5.0, 2.0)) // fmt.Println(area._TrianguloEq(5.0, 2.0)) => não funcionar , pois essa função é privada para outros pacotes }
package main import ( "bufio" "encoding/json" "fmt" "io" "log" "net" "strings" "time" "github.com/hfgo/datafile" ) type CallbackResp struct { Msg string Reqid int } func handleCallBackResp(conn net.Conn) { defer conn.Close() buf := make([]byte, 32) var resp CallbackResp resp.Msg = "wait" resp.Reqid = 100 for { respLen, err := conn.Read(buf) fmt.Println("Received as callback", string(buf)) if err != nil { log.Fatal(err) } else if err == io.EOF { fmt.Println("Server has closed the connection") break } else { err = json.Unmarshal(buf[:respLen], &resp) if err != nil { fmt.Println("Error during unMarshall") //log.Fatal(err) resp.Msg = "" resp.Reqid = 0 } else { //fmt.Println(respLen, ":", resp) resp.Msg = "" resp.Reqid = 0 } } } } func handleCallback() { listner, err := net.Listen("tcp", ":8013") if err != nil { log.Panic(err) } defer listner.Close() for { conn, err := listner.Accept() if err != nil { log.Println(err) } go handleCallBackResp(conn) } } func connectServer() (net.Conn, error) { var conn net.Conn var err error conn, err = net.Dial("tcp", "127.0.0.1:8011") if err != nil { log.Fatalln(err) } return conn, err } func main() { fileName := "input2.txt" clientReader, err := datafile.GetString(fileName) if err != nil { log.Fatal(err) } conn, err := connectServer() if err != nil { log.Fatalln(err) } defer conn.Close() go handleCallback() serverReader := bufio.NewReader(conn) startTime := time.Now() log.Printf("Begin to start transmitting now \n") for _, value := range clientReader { fmt.Fprintf(conn, value+"\n") // Write data to server servResp, err := serverReader.ReadString('\n') // Read response from the server if err == io.EOF { fmt.Println("EOF.Server closed the connection") } else if err == nil { fmt.Println(strings.TrimSpace(servResp)) } else { log.Printf("Server error : %v\n", err) time.Sleep(2 * time.Second) conn, err = connectServer() continue //time.Sleep(4 * time.Second) } } time.Sleep(time.Duration(2) * time.Second) endTime := time.Now() diff := endTime.Sub(startTime) fmt.Print("Total time taken for 500 req is ", diff.Seconds(), " seconds") log.Printf("Ending now\n") }
/* Implement the RandomizedSet class: RandomizedSet() Initializes the RandomizedSet object. bool insert(int val) Inserts an item val into the set if not present. Returns true if the item was not present, false otherwise. bool remove(int val) Removes an item val from the set if present. Returns true if the item was present, false otherwise. int getRandom() Returns a random element from the current set of elements (it's guaranteed that at least one element exists when this method is called). Each element must have the same probability of being returned. You must implement the functions of the class such that each function works in average O(1) time complexity. Example 1: Input ["RandomizedSet", "insert", "remove", "insert", "getRandom", "remove", "insert", "getRandom"] [[], [1], [2], [2], [], [1], [2], []] Output [null, true, false, true, 2, true, false, 2] Explanation RandomizedSet randomizedSet = new RandomizedSet(); randomizedSet.insert(1); // Inserts 1 to the set. Returns true as 1 was inserted successfully. randomizedSet.remove(2); // Returns false as 2 does not exist in the set. randomizedSet.insert(2); // Inserts 2 to the set, returns true. Set now contains [1,2]. randomizedSet.getRandom(); // getRandom() should return either 1 or 2 randomly. randomizedSet.remove(1); // Removes 1 from the set, returns true. Set now contains [2]. randomizedSet.insert(2); // 2 was already in the set, so return false. randomizedSet.getRandom(); // Since 2 is the only number in the set, getRandom() will always return 2. Constraints: -2^31 <= val <= 2^31 - 1 At most 2 * 10^5 calls will be made to insert, remove, and getRandom. There will be at least one element in the data structure when getRandom is called. */ package main import ( "math/rand" "time" ) func main() { r := NewRandomSet() assert(r.Insert(1) == true) assert(r.Remove(2) == false) assert(r.Insert(2) == true) x := r.Random() assert(x == 1 || x == 2) assert(r.Remove(1) == true) assert(r.Insert(2) == false) for i := 0; i < 1e6; i++ { assert(r.Random() == 2) } assert(r.Remove(2) == true) for i := 10; i <= 20; i++ { assert(r.Insert(i) == true) } for i := 12; i <= 20; i += 2 { assert(r.Remove(i) == true) } for i := 0; i < 1e6; i++ { x := r.Random() assert(10 <= x && x <= 20) assert(x == 10 || (x&1) != 0) } } func assert(x bool) { if !x { panic("assertion failed") } } type RandomSet struct { rng *rand.Rand indices map[int]int values []int } func NewRandomSet() *RandomSet { now := time.Now() source := rand.NewSource(now.UnixNano()) return &RandomSet{ rng: rand.New(source), indices: make(map[int]int), } } func (r *RandomSet) Insert(val int) bool { _, exist := r.indices[val] if exist { return false } r.indices[val] = len(r.values) r.values = append(r.values, val) return true } func (r *RandomSet) Remove(val int) bool { i, exist := r.indices[val] if !exist { return false } n := len(r.values) - 1 x := r.values[n] r.indices[x] = i r.values[i], r.values[n] = r.values[n], r.values[i] r.values = r.values[:n] delete(r.indices, val) return true } func (r *RandomSet) Random() int { n := len(r.values) if n == 0 { return 0 } i := r.rng.Intn(n) return r.values[i] }
package greq import ( "encoding/json" "fmt" "log" "net/http" "net/http/httptest" "reflect" "testing" ) const ( person = "person" book = "book" ) type Command struct { ObjectToFetch string } type Person struct { Name string HairColor string } type Book struct { Title string CopiesSold int } var mockServerHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if r.Header.Get("Auth") == "secret-key" { fmt.Fprintln(w, `{"name": "Admin", "hairColor": "Gold"}`) return } var command Command err := json.NewDecoder(r.Body).Decode(&command) if err != nil { fmt.Fprint(w, "error") return } switch command.ObjectToFetch { case person: fmt.Fprintln(w, `{"name": "James", "hairColor": "Brown"}`) return case book: fmt.Fprintln(w, `{"title": "Hitchhiker's Guide to the Galaxy", "copiesSold": 42}`) return } fmt.Fprintln(w, `{"name": "James", "hairColor": "Brown"}`) }) func TestRequest(t *testing.T) { testServer := httptest.NewServer(mockServerHandler) defer testServer.Close() tests := []struct { name string method func(string, ...Configurer) (*Response, error) url string body interface{} bodyBytes []byte headers map[string]string response interface{} expectedResponse interface{} }{ { name: "regular get", method: Get, url: testServer.URL, response: &Person{}, expectedResponse: &Person{ Name: "James", HairColor: "Brown", }, }, { name: "get with headers", method: Get, url: testServer.URL, headers: map[string]string{ "Auth": "secret-key", }, response: &Person{}, expectedResponse: &Person{ Name: "Admin", HairColor: "Gold", }, }, { name: "post with body", method: Post, url: testServer.URL, body: Command{ ObjectToFetch: book, }, response: &Book{}, expectedResponse: &Book{ Title: "Hitchhiker's Guide to the Galaxy", CopiesSold: 42, }, }, { name: "post with body bytes", method: Post, url: testServer.URL, bodyBytes: []byte(`{"objectToFetch": "book"}`), response: &Book{}, expectedResponse: &Book{ Title: "Hitchhiker's Guide to the Galaxy", CopiesSold: 42, }, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { res, err := test.method( test.url, Body(test.body), BodyBytes(test.bodyBytes), Headers(test.headers), ) if err != nil { t.Fatal(err) } err = res.JSON(test.response) if err != nil { t.Fatal(err) } if !reflect.DeepEqual(test.response, test.expectedResponse) { t.Fatalf("expected %#v to equal %#v", test.response, test.expectedResponse) } }) } } func ExampleRequest() { res, err := Post("people-and-books.com", Body(Command{ObjectToFetch: book})) if err != nil { log.Fatalln(err) } var book Book res.JSON(&book) }
package testcase type Options[T any] struct { ch1 chan T `option:"mandatory" validate:"required"` ch2 <-chan T `option:"mandatory"` ch3 chan T ch4 <-chan T }
package main import "fmt" func main() { var c chan int fmt.Println("cap", cap(c), "len", len(c)) }
// Copyright 2014 The Sporting Exchange Limited. All rights reserved. // Use of this source code is governed by a free license that can be // found in the LICENSE file. package collect import ( "opentsp.org/contrib/collect-netscaler/nitro" "opentsp.org/internal/tsdb" ) func init() { registerStatFunc("responderpolicy", responderPolicy) } func responderPolicy(emit emitFn, r *nitro.ResponseStat) { for _, p := range r.ResponderPolicy { post := " name=" + tsdb.Clean(*p.Name) emit("responderpolicy.HitsRate"+post, *p.HitsRate) emit("responderpolicy.UndefHitsRate"+post, *p.UndefHitsRate) } }
package fractalnoise import ( "testing" "github.com/lmbarros/sbxs_go_noise" "github.com/lmbarros/sbxs_go_test/test/assert" ) // mockedNoise is a fake noise generator, which always returns 1.0. type mockedNoise struct{} func (n *mockedNoise) Noise1D(x float64) float64 { return 1.0 } func (n *mockedNoise) Noise2D(x, y float64) float64 { return 1.0 } func (n *mockedNoise) Noise3D(x, y, z float64) float64 { return 1.0 } func (n *mockedNoise) Noise4D(x, y, z, w float64) float64 { return 1.0 } // Tests 1D fractal noise. func TestFractalNoise1D(t *testing.T) { // 1D, default gain of 0.5 mn := noise.Noiser1D(&mockedNoise{}) fn := New1D(mn, Params{Layers: 2}) noise := fn.Noise1D(0.0) assert.Equal(t, noise, 1.5) } // Tests 2D fractal noise. func TestFractalNoise2D(t *testing.T) { // 2D, default gain of 0.5 mn := noise.Noiser2D(&mockedNoise{}) fn := New2D(mn, Params{Layers: 5}) noise := fn.Noise2D(0.0, 0.0) assert.Equal(t, noise, 1.9375) } // Tests 3D fractal noise. func TestFractalNoise3D(t *testing.T) { // 3D, gain = 0.8, default 4 layers mn := noise.Noiser3D(&mockedNoise{}) fn := New3D(mn, Params{Gain: 0.8}) noise := fn.Noise3D(0.0, 0.0, 0.0) epsilon := 1e-7 assert.Close64(t, noise, 2.952, epsilon) } // Tests 4D fractal noise. func TestFractalNoise4D(t *testing.T) { // 4D, gain = 0.1 mn := noise.Noiser4D(&mockedNoise{}) fn := New4D(mn, Params{Layers: 3, Gain: 0.1}) noise := fn.Noise4D(0.0, 0.0, 0.0, 0.0) assert.Equal(t, noise, 1.11) }
package testutil import ( "fmt" "reflect" "runtime" "testing" ) const ( END = "\033[0m" // Encodes end RED = "\033[91m" ) // Returns a formatted string containing file name, // line number and function name. func getInfo() string { pc, file, line, ok := runtime.Caller(2) testName := "" if ok { test := runtime.FuncForPC(pc) if test != nil { testName = test.Name() } } return fmt.Sprintf("\nfile: %s\nline: %d\nfunction: %s\nmessage", file, line, testName) } // Throws an error if the type of got and the type of want mismatch // or their values don't match. // Note: Supported types - int, uint64, string, bool func AssertEquals(t *testing.T, got, want interface{}) { context := getInfo() gotType := reflect.TypeOf(got) wantType := reflect.TypeOf(want) if gotType != wantType { t.Errorf("%s: type mismatch", context) } switch got.(type) { case int: if got.(int) != want.(int) { msg := fmt.Sprintf("got: '%d', want: '%d'", got.(int), want.(int)) t.Errorf("%s: %s", inRed(context), inRed(msg)) } case uint64: if got.(uint64) != want.(uint64) { msg := fmt.Sprintf("got: '%d', want: '%d'", got.(uint64), want.(uint64)) t.Errorf("%s: %s", inRed(context), inRed(msg)) } case string: if got.(string) != want.(string) { msg := fmt.Sprintf("got: '%s', want: '%s'", got.(string), want.(string)) t.Errorf("%s: %s", inRed(context), inRed(msg)) } case bool: if got.(bool) != want.(bool) { msg := fmt.Sprintf("got: %t, want: %t", got.(bool), want.(bool)) t.Errorf("%s: %s", inRed(context), inRed(msg)) } default: t.Errorf("%s: %s", inRed(context), inRed("unsupported type")) } } // Throws an error if got is not true func AssertTrue(t *testing.T, got bool, msg string) { context := getInfo() if !got { t.Errorf("%s: %s", inRed(context), inRed(msg)) } } // Throws an error if got is true func AssertFalse(t *testing.T, got bool, msg string) { context := getInfo() if got { t.Errorf("%s: %s", inRed(context), inRed(msg)) } } func inRed(s string) string { return RED + s + END }
package main //Embedding one type inside the other import "fmt" type person struct { first, last string age int } type crossfitter struct { person background string } func main() { cf1 := crossfitter{ person: person{ first: "Brent", last: "Fikowski", age: 29, }, background: "volleyball", } cf2 := crossfitter{ person: person{ first: "Pat", last: "Vellner", age: 29, }, background: "gymnastics", } fmt.Println(cf1) fmt.Println(cf2) fmt.Printf("%v %v is %v years old, has background in %v\n", cf1.first, cf1.last, cf1.age, cf1.background) fmt.Printf("%v %v is %v years old, has background in %v\n", cf2.first, cf2.last, cf2.age, cf2.background) }
// // direct test of secure vs non-secure websockets, wss and ws uri schemes respectively // // to run this test: // // 1. "go run ws.go" // 2. in a browser, visit unsecure url "http://localhost:8080" --- // this is insecure version, you should see echo messages once per second // 3. in a browser, visit secure url "https://localhost:8090" --- // this is secure version, depending on browser type, you should see same output as insecure version, or error; note // that you will have to accept the untrusted certificate below and/or security exception manually when prompted. // // in particular, wss does not work in my chrome 28.0.1500.95 (it silently fails on both browser and server sides), // but works in "Opera 12.16 Build 1860 for Linux x86_64" and also works in mozilla firefox 23.0. // // unsecure version works fine in all three browsers i tested. // package main import ( "bytes" "code.google.com/p/go.net/websocket" "fmt" "io" "io/ioutil" "net/http" "os" "time" ) func main() { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { defer r.Body.Close() switch r.URL.Path { case "/": u := func() string { if r.TLS == nil { return "ws://localhost:8080/sock" } else { return "wss://localhost:8090/sock" } }() http.ServeContent(w, r, "index.html", time.Now(), bytes.NewReader([]byte(Content(u)))) case "/sock": websocket.Handler(EchoHandler).ServeHTTP(w, r) default: http.NotFound(w, r) } }) done := make(chan bool) go func() { fmt.Println(http.ListenAndServe(":8080", nil)) done <- true }() go func() { ioutil.WriteFile(CERT_NAME, []byte(CERT), os.ModePerm) ioutil.WriteFile(KEY_NAME, []byte(KEY), os.ModePerm) fmt.Println(http.ListenAndServeTLS(":8090", CERT_NAME, KEY_NAME, nil)) done <- true }() <-done } func EchoHandler(ws *websocket.Conn) { io.Copy(ws, ws) } func Content(ws string) string { return fmt.Sprintf(`<!DOCTYPE html> <html lang='en'> <head> <meta charset='utf-8'/> <title>websocket test</title> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> </head> <body> <p> go-lang / chrome websocket test at %s: </p> <ol/> <script> var log = function(e) { $('ol').append("<li>"+JSON.stringify(e)+"</li>"); } var sock = new WebSocket("%s") sock.onerror = function(e) { log({ERROR:e}) }; sock.onclose = function(e) { log({CLOSE:e}) }; sock.onmessage = function(e) { log({MESSAGE:e.data}) }; sock.onopen = function(e) { log({OPEN:e}) setInterval(function() { sock.send("howdy at " + new Date()); },1000); }; </script> </body> </html> `, ws, ws) } const ( CERT_NAME = "/tmp/cert.prm" CERT = `-----BEGIN CERTIFICATE----- MIIC4zCCAc2gAwIBAgIBADALBgkqhkiG9w0BAQUwEjEQMA4GA1UEChMHQWNtZSBD bzAeFw0xMzA4MTIxOTUzNTdaFw0xNDA4MTIxOTUzNTdaMBIxEDAOBgNVBAoTB0Fj bWUgQ28wggEgMAsGCSqGSIb3DQEBAQOCAQ8AMIIBCgKCAQEAw917qyvQTFtr65LQ MimR7obQzOc05YvqH/ytdtqSyPqQsvnOLi0Jk2/t33RpqIGb36dIMGDV3X5SpiLW 9TReidxtz22YbZ1CTRUgdcF5XJiq3CO5a+1vGvi/fIBIqzPb6CQwgG/eFm6xdvgf IRodZgM6ym6cglm6ndhoB4/TpIni/i+bo757LUxfu78/mkUBfsQK0VDaqq59ZkZW An8E/4DBeDdg8jq9i+4VuOTSulfiLu06eIWoAhfBeWX6uGaEK44xW5NJpp1y4CKX BOvVKuz+Dv4jz/vp1e8p1zFqkUzbrtdVv+Z3olfTHQWe1qMpt9l01tedxuPTEHas HTQiRwIDAQABo0owSDAOBgNVHQ8BAf8EBAMCAKAwEwYDVR0lBAwwCgYIKwYBBQUH AwEwDAYDVR0TAQH/BAIwADATBgNVHREEDDAKggh4dXZhLmNvbTALBgkqhkiG9w0B AQUDggEBAFppIRxB25BRCK1w//9U73sddEnw2Q/MUR+V4twB5qVGnnY6VJW+u9W3 9dNs4teemAxUJh7ZBOR2xEj1N6Q9D0H3BFupUNRa9jIxWam+E+mNCF1jQRlTxCur WHk56ZmsqWyb8yXIB3ymHyAXnJziAUO/US6e8xeMKcvIZCtCzCsaOLI5G35h9xoJ +mKedqOW7tGmT3suqj/bx2hEq1nPRW/H9XmyLkDMvIiUaU8iopKzShuyG/kosRXY WsoDWrkv3a0O1crnlQLZXg1IH0/bQg7OwJz5P8qDSNR1uiBzGkmbOFpp0IVCdVIk UwKAnERUK1MkYu6jh5hXj6mb0fW01/o= -----END CERTIFICATE-----` KEY_NAME = "/tmp/key.pem" KEY = `-----BEGIN RSA PRIVATE KEY----- MIIEowIBAAKCAQEAw917qyvQTFtr65LQMimR7obQzOc05YvqH/ytdtqSyPqQsvnO Li0Jk2/t33RpqIGb36dIMGDV3X5SpiLW9TReidxtz22YbZ1CTRUgdcF5XJiq3CO5 a+1vGvi/fIBIqzPb6CQwgG/eFm6xdvgfIRodZgM6ym6cglm6ndhoB4/TpIni/i+b o757LUxfu78/mkUBfsQK0VDaqq59ZkZWAn8E/4DBeDdg8jq9i+4VuOTSulfiLu06 eIWoAhfBeWX6uGaEK44xW5NJpp1y4CKXBOvVKuz+Dv4jz/vp1e8p1zFqkUzbrtdV v+Z3olfTHQWe1qMpt9l01tedxuPTEHasHTQiRwIDAQABAoIBAA22+4rf1YUTPbpQ HG32xTYrkIFYizarlmhI/Ch/Y5nZGbq+jTZkhvAg/UoRT7ix4qVFhGOG1FLfHpBt jhm7YgdLPREyPmMmiNb27L/yHTpjoksp4Tjydj4wPtBL90qtpe9aYV8M9kMh2yFW fG+H8ZkMDtjP5/ukptGYrqgg5RP3SGacLGdmdCakesCP/+bjSjKVyHsBThybr5oy zSsLaGocU6JL7k6x1lbnbToSwQo5ORRgWzsVIc68qm4Nc4+Nn9lrhMqlucYMtrxf EyNpcCUFuO1BMz1jJwP5zttY0ZRKWitaDRpVyZhKMonUSsYIfRV+kM9+qKatZGbW Tuh9dLkCgYEA3pSRWsyCHxmVDXpTAw0EPSZISaAqq5RSZoBtJkKBGpqxs245RI4E FQN2d3oPpI3qBf3J6+lLRy4W0Hju+UxSzqdCHONmngdxbzOuMdoianjwviwr+ZjM e8kmFtQ72KK6rEYsaywYxH7NVutXmmK3eXkH3MD6/0fwMSFVBwJ1piMCgYEA4UYM /KOHzosscvGNPFW8U8b+5yNTh/Vm2CVBCe+ZwUA6WEE+nwGh4FVE5tmxzlXOr91h I6LJ3WeV/byUl+5wAwAe4cBGwSrjOeR5VOgI+zXCH7LzKZG0EMTxhzRKs/R89gWi zVL8noy1VomNLo2C+O9YBTLYF6S3Uu3PCmwda40CgYEAvwW4XbnILtKwxjlmRucD 7UsOnQl1tX183nV3t286B9AdlAWT5o8PV815/X3nMO2OnAe8JNg6f+NBNzeiuJfV NX/8UHilGBkBNFOhOy2ffcs/qaaVMwf87nuqUcthdUHrfXBYLL5Sn0jIB8HAlEIG fpztr3p7r11Y+YFGzNZCjAsCgYAo5qoW+K4Arz4rxHWrPbnK0DeZyc0xwzmgBuuP HUSiVMIDIh13izlT3Md8zou89dFoFt67NKRIIbWW8zVbfHwz30K8JEf0bJADA9uP se1nhvQvAzOpGX5DCS79KF5j3AEQPie39dhOBSgrhR/wEttzzSkDEJ8xc8OhN/I+ ZzDURQKBgAS8tKXfammEZBhLc1NGphBYf5HLXQEMm3Uqy7xW82YLjz6KN27x1fhz YcZbFvY6KAsisGqZFUwlTecbZC8teFkFfoMWtu99fpPuLnlSr1MgLTchqnm1P70f wWHpDR5CmggfYMrt/Hw1UQkRsDxuYnp6lnD8BOVZPo8jiMpUJmI8 -----END RSA PRIVATE KEY-----` )
package pie_test import ( "github.com/elliotchance/pie/v2" "github.com/stretchr/testify/assert" "testing" ) func TestGroup(t *testing.T) { assert.Equal(t, map[float64]int{}, pie.Group([]float64{})) assert.Equal(t, map[float64]int{ 1: 1, }, pie.Group([]float64{1})) assert.Equal(t, map[float64]int{ 1: 1, 2: 2, 3: 3, }, pie.Group([]float64{1, 2, 2, 3, 3, 3})) }
package ch1 import ( "testing" ) func Test_consumerAndProducer(t *testing.T) { cls := make(chan struct{}, 0) consumerAndProducer(10, cls) close(cls) }
package main import ( "fmt" "math/rand" "time" ) func testBadGoodTest() { doWork := func(done <-chan interface{}, nums ...int) (<-chan interface{}, <-chan int) { heartbeatStream := make(chan interface{}, 1) intStream := make(chan int) go func() { defer close(heartbeatStream) defer close(intStream) //could put some delay here if the test takes time to run. time.Sleep(2 * time.Second) sendPulse := func() { select { case heartbeatStream <- struct{}{}: default: } } sendResult := func(n int) { select { case <-done: return case intStream <- n: } } for _, n := range nums { fmt.Println("In loop: ", n) sendPulse() sendResult(n) } }() return heartbeatStream, intStream } //Without heartbeat, can't control the flow, it becomes nondeterministic //it's not that this kind of test down there won't work, it's that it can't //give out the best answer it could give. The good version could though. //Can't recreate, just pure understanding // theBadTest := func(t *testing.T) { // theBadTest := func() { // done := make(chan interface{}) // defer close(done) // intSlice := []int{0, 1, 2, 3, 5} // _, results := doWork(done, intSlice...) // for i, expected := range intSlice { // fmt.Println("In test: ", expected) // select { // case r := <-results: // if r != expected { // fmt.Printf("index %v: expected %v, but received %v,", // i, // expected, // r) // return // // t.Errorf( // // "index %v: expected %v, but received %v,", // // i, // // expected, // // r, // // ) // } // case <-time.After(1 * time.Second): // // t.Fatal("test timed out") // fmt.Println("test timed out") // break // } // } // } // theBadTest() //use heartbeat, 1 heartbeat means 1 result, flow becomes easy to control // theGoodTest = func(t *testing.T) { theGoodTest := func() { done := make(chan interface{}) defer close(done) intSlice := []int{0, 1, 2, 3, 5} heartbeat, results := doWork(done, intSlice...) // _, results := doWork(done, intSlice...) fmt.Println("Yo1") fmt.Println("Heartbeat pumping: ", <-heartbeat) //remember even though it only has 1 slot, so it's blocking the flow of the doWork. //so the doWork is not actually finished yet, it's pending for the pump signal. When the pump signal //is called, everything will continue doing their job. Feeling like heartbeat is like a trigger waiting the gun to be loaded to fire later. //still work without heartbeat but the mechanism is still the same, the doWork is still blocked, //until that _ is called out, it's an empty space for the heartbeatstream to spit out its beats. for i, expected := range intSlice { fmt.Println("In test: ", expected) select { case r := <-results: if r != expected { fmt.Printf("index %v: expected %v, but received %v,", i, expected, r) return // t.Errorf( // "index %v: expected %v, but received %v,", // i, // expected, // r, // ) } case <-time.After(1 * time.Second): // t.Fatal("test timed out") fmt.Println("test timed out") break } } // i := 0 // for r := range results { // fmt.Println("In test: r: ", r, " expected: ", intSlice[i]) // if expected := intSlice[i]; r != expected { // // t.Errorf("index %v: expected %v, but received %v,", i, expected, // // r) // fmt.Printf("index %v: expected %v, but received %v,", i, expected, // r) // return // } // i++ // } } theGoodTest() } //this thing sends out results instantly... Quite weird for a goroutine stuff. Good for testing they say. func testWeirdPulse() { doWork := func(done <-chan interface{}) (<-chan interface{}, <-chan int) { heartbeatStream := make(chan interface{}, 1) workStream := make(chan int) go func() { defer close(heartbeatStream) defer close(workStream) //could put some delay here if the test takes time to run. sendPulse := func() { select { case heartbeatStream <- struct{}{}: default: } } sendResult := func() { select { case <-done: return case workStream <- rand.Intn(10): } } for i := 0; i < 10; i++ { sendPulse() sendResult() } }() return heartbeatStream, workStream } done := make(chan interface{}) defer close(done) heartbeat, results := doWork(done) for { select { case _, ok := <-heartbeat: if ok { fmt.Println("pulse") } else { return } case r, ok := <-results: if ok { fmt.Printf("results %v\n", r) } else { return } } } } func testBadHeartbeat() { doWork := func(done <-chan interface{}, pulseInterval time.Duration) (<-chan interface{}, <-chan time.Time) { heartbeat := make(chan interface{}) results := make(chan time.Time) go func() { // defer close(heartbeat) // defer close(results) pulse := time.Tick(pulseInterval) workGen := time.Tick(2 * pulseInterval) sendPulse := func() { select { case heartbeat <- struct{}{}: default: } } sendResult := func(r time.Time) { for { select { case <-pulse: sendPulse() case results <- r: return } } } // for{ for i := 0; i < 2; i++ { select { case <-done: return case <-pulse: sendPulse() case r := <-workGen: sendResult(r) } } }() return heartbeat, results } done := make(chan interface{}) time.AfterFunc(10*time.Second, func() { close(done) }) const timeout = 2 * time.Second heartbeat, results := doWork(done, timeout/2) for { select { case _, ok := <-heartbeat: if ok == false { return } fmt.Println("Pulse") case r, ok := <-results: if ok == false { return } fmt.Println("Results ", r.Second()) case <-time.After(timeout): fmt.Println("worker goroutine is not healthy!") return } } } func testGoodHeartbeat() { doWork := func(done <-chan interface{}, pulseInterval time.Duration) (<-chan interface{}, <-chan time.Time) { heartbeat := make(chan interface{}) results := make(chan time.Time) go func() { defer close(heartbeat) defer close(results) pulse := time.Tick(pulseInterval) workGen := time.Tick(2 * pulseInterval) sendPulse := func() { select { case heartbeat <- struct{}{}: default: } } sendResult := func(r time.Time) { for { select { case <-done: return case <-pulse: sendPulse() case results <- r: return } } } for { select { case <-done: return case <-pulse: sendPulse() case r := <-workGen: sendResult(r) } } }() return heartbeat, results } done := make(chan interface{}) time.AfterFunc(11*time.Second, func() { close(done) }) const timeout = 2 * time.Second heartbeat, results := doWork(done, timeout/2) for { select { case _, ok := <-heartbeat: if ok == false { return } fmt.Println("Pulse") case r, ok := <-results: if ok == false { return } fmt.Println("Results ", r.Second()) case <-time.After(timeout): fmt.Println("If this shows up then there's a goroutine problem") return } } }
package bmrouter import ( "encoding/json" "fmt" "github.com/alfredyang1986/blackmirror/bmalioss" "github.com/alfredyang1986/blackmirror/bmcommon/bmsingleton/bmpkg" "github.com/alfredyang1986/blackmirror/bmrouter/bmoauth" "github.com/alfredyang1986/blackmirror/jsonapi/jsonapiobj" "io" "io/ioutil" "os" "errors" "github.com/gorilla/mux" "net/http" "strconv" "strings" "sync" "github.com/alfredyang1986/blackmirror/bmconfighandle" "github.com/hashicorp/go-uuid" ) var rt *mux.Router var o sync.Once func BindRouter() *mux.Router { o.Do(func() { rt = mux.NewRouter() rt.HandleFunc("/upload", upload2OssFunc) rt.HandleFunc("/maxupload", uploadCommonFunc) rt.HandleFunc("/download/{filename}", downloadFunc) rt.HandleFunc("/resource/{filename}", getResourceFunc) rt.HandleFunc("/api/v1/{package}/{cur}", func(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) var cur int64 = 0 pkg := vars["package"] // the book title slug strcur := vars["cur"] // the page if strcur != "" { cur, _ = strconv.ParseInt(strcur, 10, 0) } var err error bauth := bmpkg.IsNeedAuth(pkg, cur) if bauth { fmt.Println("need oauth") bearer := r.Header.Get("Authorization") tmp := strings.Split(bearer, " ") fmt.Println(tmp) if len(tmp) < 2 { err = errors.New("not authorized") } else { err = bmoauth.CheckToken(tmp[1]) } } if err != nil { //panic(err) w.Header().Add("Content-Type", "application/json") SimpleResponseForErr(err.Error(), w) return } face, _ := bmpkg.GetCurBrick(pkg, cur) InvokeSkeleton(w, r, face, pkg, cur) }) }) return rt } func upload2OssFunc(w http.ResponseWriter, r *http.Request) { //fmt.Println("method:", r.Method) w.Header().Add("Content-Type", "application/json") if r.Method == "GET" { errMsg := "upload request method error, please use POST." SimpleResponseForErr(errMsg, w) } else { r.ParseMultipartForm(32 << 20) //file, handler, err := r.FormFile("file") file, handler, err := r.FormFile("file") if err != nil { fmt.Println(err) errMsg := "upload file key error, please use key 'file'." SimpleResponseForErr(errMsg, w) return } defer file.Close() //TODO: 配置文件路径 待 用脚本指定dev路径和deploy路径 var bmRouter bmconfig.BMRouterConfig //once.Do(bmRouter.GenerateConfig) bmRouter.GenerateConfig() fn, err := uuid.GenerateUUID() lsttmp := strings.Split(handler.Filename, ".") exname := lsttmp[len(lsttmp) - 1] localDir := bmRouter.TmpDir + "/" + fn + "." + exname // handler.Filename f, err := os.OpenFile(localDir, os.O_WRONLY|os.O_CREATE, 0666) if err != nil { fmt.Println("OpenFile error") fmt.Println(err) errMsg := "upload local file open error." SimpleResponseForErr(errMsg, w) return } defer f.Close() io.Copy(f, file) result := map[string]string{ //"file": handler.Filename, "file": fn, } //bmalioss.QuerySTSToken() bmalioss.PushOneObject("bmsass", fn, localDir) response := map[string]interface{}{ "status": "ok", "result": result, "error": "", } jso := jsonapiobj.JsResult{} jso.Obj = response enc := json.NewEncoder(w) enc.Encode(jso.Obj) } } func uploadCommonFunc(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Type", "application/json") if r.Method == "GET" { errMsg := "upload request method error, please use POST." SimpleResponseForErr(errMsg, w) } else { r.ParseMultipartForm(32 << 20) file, handler, err := r.FormFile("file") if err != nil { fmt.Println(err) errMsg := "upload file key error, please use key 'file'." SimpleResponseForErr(errMsg, w) return } defer file.Close() //TODO: 配置文件路径 待 用脚本指定dev路径和deploy路径 var bmRouter bmconfig.BMRouterConfig bmRouter.GenerateConfig() localDir := bmRouter.TmpDir + "/" + handler.Filename f, err := os.OpenFile(localDir, os.O_WRONLY|os.O_CREATE, 0666) if err != nil { fmt.Println("OpenFile error") fmt.Println(err) errMsg := "upload local file open error." SimpleResponseForErr(errMsg, w) return } defer f.Close() io.Copy(f, file) result := map[string]string{ "file": handler.Filename, } response := map[string]interface{}{ "status": "ok", "result": result, "error": "", } jso := jsonapiobj.JsResult{} jso.Obj = response enc := json.NewEncoder(w) enc.Encode(jso.Obj) } } func downloadFunc(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) filename := vars["filename"] //TODO: 配置文件路径 待 用脚本指定dev路径和deploy路径 localFile := "resource/" + filename out, err := ioutil.ReadFile(localFile) //defer os.Remove(localFile) if err != nil { fmt.Println("error") fmt.Println(err.Error()) } w.Header().Set("Content-Disposition", "attachment; filename=" + filename) w.Header().Set("Content-Type", r.Header.Get("Content-Type")) //w.Header().Set("charset", "utf-8") w.Write(out) } func getResourceFunc(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) filename := vars["filename"] //TODO: 配置文件路径 待 用脚本指定dev路径和deploy路径 localFile := "resource-public/" + filename out, err := ioutil.ReadFile(localFile) if err != nil { fmt.Println("error") fmt.Println(err.Error()) } w.Write(out) } func SimpleResponseForErr(errMsg string, w io.Writer) { response := map[string]interface{}{ "status": 401.1, "result": errMsg, "error": "client error", } jso := jsonapiobj.JsResult{} jso.Obj = response enc := json.NewEncoder(w) enc.Encode(jso.Obj) }
package main import ( "bufio" "middleware-bom/model" "middleware-bom/publisher" "middleware-bom/subscriber" "os" "strconv" "strings" "time" ) func main() { println("1 for measurer, 2 for measuree") reader := bufio.NewReader(os.Stdin) choice, _ := reader.ReadString('\n') if strings.HasPrefix(choice, "1") { println("how many?") num, _ := reader.ReadString('\n') num = strings.ReplaceAll(num, "\n", "") num = strings.ReplaceAll(num, "\r", "") n, _ := strconv.ParseInt(num, 10, 64) p, _ := publisher.NewPublisher("a", "localhost:7447") s, _ := subscriber.NewSubscriber("b", "localhost:7447") c := s.Subscribe() rec := make(chan interface{}, 5 * n) go func() { for{ msg, more := <- c if more { rec <- msg } else { break } } }() start := time.Now() go func() { for i:= int64(0); i<n; i++ { p.Publish(model.Content{Content:"oi"}) } }() for j:= int64(0); j<n; j++ { _, more := <- rec if more { continue } } elapsed := time.Since(start) print("Elapsed time: ") print(elapsed.Nanoseconds() / 1000000) print("ms") }else { s, _ := subscriber.NewSubscriber("a", "localhost:7447") p, _ := publisher.NewPublisher("b", "localhost:7447") c := s.Subscribe() for { _, more := <- c if more { go p.Publish(model.Content{Content:"alo"}) } else { break } } } }
package constant type NodeType string const ( Peer NodeType = "peer" Orderer NodeType = "orderer" Admin NodeType = "admin" User NodeType = "user" )
package service import ( "fmt" "strings" jwt "github.com/dgrijalva/jwt-go" "github.com/valyala/fasthttp" ) func parseAuth(ctx *fasthttp.RequestCtx) (token, sub string, err error) { token, sub, err = parseBearer(string(ctx.Request.Header.Peek("Authorization"))) if err != nil { err = fmt.Errorf("cannot parse authentication header: %v", err) } return } func parseBearer(auth string) (token, sub string, err error) { if strings.HasPrefix(auth, "Bearer ") { rawToken := auth[7:] sub, err = parseSubFromJwtToken(rawToken) if err != nil { err = fmt.Errorf("cannot parse bearer: %v", err) return } token = rawToken return } return "", "", fmt.Errorf("cannot parse bearer: prefix 'Bearer ' not found") } type claims struct { Subject string `json:"sub,omitempty"` } func (c *claims) Valid() error { return nil } func parseSubFromJwtToken(rawJwtToken string) (string, error) { parser := &jwt.Parser{ SkipClaimsValidation: true, } var claims claims _, _, err := parser.ParseUnverified(rawJwtToken, &claims) if err != nil { return "", fmt.Errorf("cannot get sub from jwt token: %v", err) } if claims.Subject != "" { return claims.Subject, nil } return "", fmt.Errorf("cannot get sub from jwt token: not found") }
package main import ( "fmt" pow "github.com/bitmaelum/bitmaelum-suite/pkg/proofofwork" "os" "strconv" ) func main() { if len(os.Args) != 3 { fmt.Printf("Usage: %s <bits> <data>", os.Args[0]) os.Exit(1) } bits, _ := strconv.Atoi(os.Args[1]) data := os.Args[2] fmt.Printf("Working on %d bits proof...\n", bits) work := pow.New(bits, data, 0) work.Work(0) fmt.Printf("Proof: %d\n", work.Proof) }
package main import ( "context" "fmt" "net/http" "os" "runtime" "time" "github.com/gin-gonic/gin" "github.com/sirupsen/logrus" ) // ServerRun server run func ServerRun(ctx context.Context, addr string, e *gin.Engine, quitTimeout time.Duration) (err error) { defer func() { if err != nil { if gin.IsDebugging() { fmt.Fprintf(os.Stderr, "[GIN-debug] [ERROR] %v\n", err) } } }() s := &http.Server{ Addr: addr, Handler: e, } format := "Listening and serving HTTP on %s\n" if gin.IsDebugging() { fmt.Fprintf(os.Stdout, "[GIN-debug] "+format, addr) } go func() { err = s.ListenAndServe() }() <-ctx.Done() ctx, cancel := context.WithTimeout(context.Background(), quitTimeout) defer cancel() if err := s.Shutdown(ctx); err != nil { logrus.Errorf("failed to http server shutdown: %s", err.Error()) } return } // WrapPanicErr wrap panic to error func WrapPanicErr(err error, panicErr interface{}) error { if panicErr == nil { return err } var buf [4096]byte n := runtime.Stack(buf[:], false) newErr := fmt.Errorf("unexpected error: %v\nstack: %s", panicErr, buf[:n]) if err == nil { return newErr } return fmt.Errorf("panic error: %s\nreturn error: %w", newErr, err) }
package gates import ( "crypto/sha256" "encoding/hex" "time" ) type Opaque struct { Id int `json:"id" db:"id"` UserId int `json:"user_id" db:"user_id"` Jwt string `json:"jwt" db:"jwt"` Opaque string `json:"opaque" db:"opaque"` CreatedAt time.Time `json:"created_at" db:"created_at"` } func NewOpaque(userId int, jwt string) *Opaque { return &Opaque{ UserId: userId, Jwt: jwt, Opaque: generateOpaqueToken(), CreatedAt: time.Now().UTC(), } } func generateOpaqueToken() string { salt := time.Now().UTC().String() hash := sha256.New().Sum([]byte(salt)) return hex.EncodeToString(hash) }
package main import "container/list" //一种方法是每一次都存储下来,层序遍历完计算每层的平均值,但该方法占用空间较大 //因此考虑遍历每层的时候就进行计算,不单独进行存储 /** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */ func averageOfLevels(root *TreeNode) []float64 { if root == nil { return nil } res := make([]float64, 0) l := list.New() l.PushBack(root) //首先放入根节点 for l.Len() > 0 { size := l.Len() //这个size记录的是当前层的节点个数 sum := 0.0 for i := 0; i < size; i++ { node := l.Front().Value.(*TreeNode) l.Remove(l.Front()) sum += float64(node.Val) if node.Left != nil { l.PushBack(node.Left) } if node.Right != nil { l.PushBack(node.Right) } } res = append(res, sum/float64(size)) } return res }
// Copyright 2016 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package grumpy import ( "io/ioutil" "os" "testing" ) func TestImportModule(t *testing.T) { f := NewRootFrame() invalidModule := newObject(ObjectType) foo := newTestModule("foo", "foo/__init__.py") bar := newTestModule("foo.bar", "foo/bar/__init__.py") baz := newTestModule("foo.bar.baz", "foo/bar/baz/__init__.py") qux := newTestModule("foo.qux", "foo/qux/__init__.py") fooCode := NewCode("<module>", "foo/__init__.py", nil, 0, func(*Frame, []*Object) (*Object, *BaseException) { return None, nil }) barCode := NewCode("<module>", "foo/bar/__init__.py", nil, 0, func(*Frame, []*Object) (*Object, *BaseException) { return None, nil }) bazCode := NewCode("<module>", "foo/bar/baz/__init__.py", nil, 0, func(*Frame, []*Object) (*Object, *BaseException) { return None, nil }) quxCode := NewCode("<module>", "foo/qux/__init__.py", nil, 0, func(*Frame, []*Object) (*Object, *BaseException) { return None, nil }) raisesCode := NewCode("<module", "raises.py", nil, 0, func(f *Frame, _ []*Object) (*Object, *BaseException) { return nil, f.RaiseType(ValueErrorType, "uh oh") }) circularImported := false circularCode := NewCode("<module>", "circular.py", nil, 0, func(f *Frame, _ []*Object) (*Object, *BaseException) { if circularImported { return nil, f.RaiseType(AssertionErrorType, "circular imported recursively") } circularImported = true if _, raised := ImportModule(f, "circular"); raised != nil { return nil, raised } return None, nil }) circularTestModule := newTestModule("circular", "circular.py").ToObject() clearCode := NewCode("<module>", "clear.py", nil, 0, func(f *Frame, _ []*Object) (*Object, *BaseException) { if _, raised := SysModules.DelItemString(f, "clear"); raised != nil { return nil, raised } return None, nil }) // NOTE: This test progressively evolves sys.modules, checking after // each test case that it's populated appropriately. oldSysModules := SysModules oldModuleRegistry := moduleRegistry defer func() { SysModules = oldSysModules moduleRegistry = oldModuleRegistry }() SysModules = newStringDict(map[string]*Object{"invalid": invalidModule}) moduleRegistry = map[string]*Code{ "foo": fooCode, "foo.bar": barCode, "foo.bar.baz": bazCode, "foo.qux": quxCode, "raises": raisesCode, "circular": circularCode, "clear": clearCode, } cases := []struct { name string want *Object wantExc *BaseException wantSysModules *Dict }{ { "noexist", nil, mustCreateException(ImportErrorType, "noexist"), newStringDict(map[string]*Object{"invalid": invalidModule}), }, { "invalid", NewTuple(invalidModule).ToObject(), nil, newStringDict(map[string]*Object{"invalid": invalidModule}), }, { "raises", nil, mustCreateException(ValueErrorType, "uh oh"), newStringDict(map[string]*Object{"invalid": invalidModule}), }, { "foo", NewTuple(foo.ToObject()).ToObject(), nil, newStringDict(map[string]*Object{ "foo": foo.ToObject(), "invalid": invalidModule, }), }, { "foo", NewTuple(foo.ToObject()).ToObject(), nil, newStringDict(map[string]*Object{ "foo": foo.ToObject(), "invalid": invalidModule, }), }, { "foo.qux", NewTuple(foo.ToObject(), qux.ToObject()).ToObject(), nil, newStringDict(map[string]*Object{ "foo": foo.ToObject(), "foo.qux": qux.ToObject(), "invalid": invalidModule, }), }, { "foo.bar.baz", NewTuple(foo.ToObject(), bar.ToObject(), baz.ToObject()).ToObject(), nil, newStringDict(map[string]*Object{ "foo": foo.ToObject(), "foo.bar": bar.ToObject(), "foo.bar.baz": baz.ToObject(), "foo.qux": qux.ToObject(), "invalid": invalidModule, }), }, { "circular", NewTuple(circularTestModule).ToObject(), nil, newStringDict(map[string]*Object{ "circular": circularTestModule, "foo": foo.ToObject(), "foo.bar": bar.ToObject(), "foo.bar.baz": baz.ToObject(), "foo.qux": qux.ToObject(), "invalid": invalidModule, }), }, { "clear", nil, mustCreateException(ImportErrorType, "Loaded module clear not found in sys.modules"), newStringDict(map[string]*Object{ "circular": circularTestModule, "foo": foo.ToObject(), "foo.bar": bar.ToObject(), "foo.bar.baz": baz.ToObject(), "foo.qux": qux.ToObject(), "invalid": invalidModule, }), }, } for _, cas := range cases { mods, raised := ImportModule(f, cas.name) var got *Object if raised == nil { got = NewTuple(mods...).ToObject() } switch checkResult(got, cas.want, raised, cas.wantExc) { case checkInvokeResultExceptionMismatch: t.Errorf("ImportModule(%q) raised %v, want %v", cas.name, raised, cas.wantExc) case checkInvokeResultReturnValueMismatch: t.Errorf("ImportModule(%q) = %v, want %v", cas.name, got, cas.want) } ne := mustNotRaise(NE(f, SysModules.ToObject(), cas.wantSysModules.ToObject())) b, raised := IsTrue(f, ne) if raised != nil { panic(raised) } if b { msg := "ImportModule(%q): sys.modules = %v, want %v" t.Errorf(msg, cas.name, SysModules, cas.wantSysModules) } } } func TestModuleGetNameAndFilename(t *testing.T) { fun := wrapFuncForTest(func(f *Frame, m *Module) (*Tuple, *BaseException) { name, raised := m.GetName(f) if raised != nil { return nil, raised } filename, raised := m.GetFilename(f) if raised != nil { return nil, raised } return newTestTuple(name, filename), nil }) cases := []invokeTestCase{ {args: wrapArgs(newModule("foo", "foo.py")), want: newTestTuple("foo", "foo.py").ToObject()}, {args: Args{mustNotRaise(ModuleType.Call(NewRootFrame(), wrapArgs("foo"), nil))}, wantExc: mustCreateException(SystemErrorType, "module filename missing")}, {args: wrapArgs(&Module{Object: Object{typ: ModuleType, dict: NewDict()}}), wantExc: mustCreateException(SystemErrorType, "nameless module")}, } for _, cas := range cases { if err := runInvokeTestCase(fun, &cas); err != "" { t.Error(err) } } } func TestModuleInit(t *testing.T) { fun := wrapFuncForTest(func(f *Frame, args ...*Object) (*Tuple, *BaseException) { o, raised := ModuleType.Call(f, args, nil) if raised != nil { return nil, raised } name, raised := GetAttr(f, o, internedName, None) if raised != nil { return nil, raised } doc, raised := GetAttr(f, o, NewStr("__doc__"), None) if raised != nil { return nil, raised } return NewTuple(name, doc), nil }) cases := []invokeTestCase{ {args: wrapArgs("foo"), want: newTestTuple("foo", None).ToObject()}, {args: wrapArgs("foo", 123), want: newTestTuple("foo", 123).ToObject()}, {args: wrapArgs(newObject(ObjectType)), wantExc: mustCreateException(TypeErrorType, `'__init__' requires a 'str' object but received a "object"`)}, {wantExc: mustCreateException(TypeErrorType, "'__init__' requires 2 arguments")}, } for _, cas := range cases { if err := runInvokeTestCase(fun, &cas); err != "" { t.Error(err) } } } func TestModuleStrRepr(t *testing.T) { cases := []invokeTestCase{ {args: wrapArgs(newModule("foo", "<test>")), want: NewStr("<module 'foo' from '<test>'>").ToObject()}, {args: wrapArgs(newModule("foo.bar.baz", "<test>")), want: NewStr("<module 'foo.bar.baz' from '<test>'>").ToObject()}, {args: Args{mustNotRaise(ModuleType.Call(NewRootFrame(), wrapArgs("foo"), nil))}, want: NewStr("<module 'foo' (built-in)>").ToObject()}, {args: wrapArgs(&Module{Object: Object{typ: ModuleType, dict: newTestDict("__file__", "foo.py")}}), want: NewStr("<module '?' from 'foo.py'>").ToObject()}, } for _, cas := range cases { if err := runInvokeTestCase(wrapFuncForTest(ToStr), &cas); err != "" { t.Error(err) } if err := runInvokeTestCase(wrapFuncForTest(Repr), &cas); err != "" { t.Error(err) } } } func TestRunMain(t *testing.T) { oldSysModules := SysModules defer func() { SysModules = oldSysModules }() cases := []struct { code *Code wantCode int wantOutput string }{ {NewCode("<test>", "test.py", nil, 0, func(*Frame, []*Object) (*Object, *BaseException) { return None, nil }), 0, ""}, {NewCode("<test>", "test.py", nil, 0, func(f *Frame, _ []*Object) (*Object, *BaseException) { return nil, f.Raise(SystemExitType.ToObject(), None, nil) }), 0, ""}, {NewCode("<test>", "test.py", nil, 0, func(f *Frame, _ []*Object) (*Object, *BaseException) { return nil, f.RaiseType(TypeErrorType, "foo") }), 1, "TypeError: foo\n"}, {NewCode("<test>", "test.py", nil, 0, func(f *Frame, _ []*Object) (*Object, *BaseException) { return nil, f.RaiseType(SystemExitType, "foo") }), 1, "foo\n"}, {NewCode("<test>", "test.py", nil, 0, func(f *Frame, _ []*Object) (*Object, *BaseException) { return nil, f.Raise(SystemExitType.ToObject(), NewInt(12).ToObject(), nil) }), 12, ""}, } for _, cas := range cases { SysModules = NewDict() if gotCode, gotOutput, err := runMainAndCaptureStderr(cas.code); err != nil { t.Errorf("runMainRedirectStderr() failed: %v", err) } else if gotCode != cas.wantCode { t.Errorf("RunMain() = %v, want %v", gotCode, cas.wantCode) } else if gotOutput != cas.wantOutput { t.Errorf("RunMain() output %q, want %q", gotOutput, cas.wantOutput) } } } func runMainAndCaptureStderr(code *Code) (int, string, error) { oldStderr := Stderr defer func() { Stderr = oldStderr }() r, w, err := os.Pipe() if err != nil { return 0, "", err } Stderr = NewFileFromFD(w.Fd(), nil) c := make(chan int) go func() { defer w.Close() c <- RunMain(code) }() result := <-c data, err := ioutil.ReadAll(r) if err != nil { return 0, "", err } return result, string(data), nil } var testModuleType *Type func init() { testModuleType, _ = newClass(NewRootFrame(), TypeType, "testModule", []*Type{ModuleType}, newStringDict(map[string]*Object{ "__eq__": newBuiltinFunction("__eq__", func(f *Frame, args Args, kwargs KWArgs) (*Object, *BaseException) { if raised := checkMethodArgs(f, "__eq__", args, ModuleType, ObjectType); raised != nil { return nil, raised } if !args[1].isInstance(ModuleType) { return NotImplemented, nil } m1, m2 := toModuleUnsafe(args[0]), toModuleUnsafe(args[1]) name1, raised := m1.GetName(f) if raised != nil { return nil, raised } name2, raised := m2.GetName(f) if raised != nil { return nil, raised } if name1.Value() != name2.Value() { return False.ToObject(), nil } file1, raised := m1.GetFilename(f) if raised != nil { return nil, raised } file2, raised := m2.GetFilename(f) if raised != nil { return nil, raised } return GetBool(file1.Value() == file2.Value()).ToObject(), nil }).ToObject(), "__ne__": newBuiltinFunction("__ne__", func(f *Frame, args Args, kwargs KWArgs) (*Object, *BaseException) { if raised := checkMethodArgs(f, "__ne__", args, ModuleType, ObjectType); raised != nil { return nil, raised } eq, raised := Eq(f, args[0], args[1]) if raised != nil { return nil, raised } isEq, raised := IsTrue(f, eq) if raised != nil { return nil, raised } return GetBool(!isEq).ToObject(), nil }).ToObject(), })) } func newTestModule(name, filename string) *Module { return &Module{Object: Object{typ: testModuleType, dict: newTestDict("__name__", name, "__file__", filename)}} }
package main import "fmt" func main() { closure() } func closure() { word := "sample" defer func(input string) { fmt.Print("case 1: ") fmt.Println(input) }(word) defer func() { fmt.Print("case 2: ") fmt.Println(word) }() word = "sample-changed" defer func(input string) { fmt.Print("case 3: ") fmt.Println(input) }(word) }
/* Copyright © 2023 SUSE LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // Package cmd implements the rdctl commands package cmd import ( "fmt" "github.com/spf13/cobra" ) // installCmd represents the 'rdctl extensions install' command var installCmd = &cobra.Command{ Use: "install", Short: "Install an RDX extension", Long: `rdctl extension install [--force] <image-id> --force: avoid any interactivity. The <image-id> is an image reference, e.g. splatform/epinio-docker-desktop:latest (the tag is optional).`, Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { cmd.SilenceUsage = true return installExtension(args) }, } func init() { extensionCmd.AddCommand(installCmd) } func installExtension(args []string) error { imageID := args[0] endpoint := fmt.Sprintf("/%s/extensions/install?id=%s", apiVersion, imageID) // https://stackoverflow.com/questions/20847357/golang-http-client-always-escaped-the-url // Looks like http.NewRequest(method, url) escapes the URL result, errorPacket, err := processRequestForAPI(doRequest("POST", endpoint)) if errorPacket != nil || err != nil { return displayAPICallResult(result, errorPacket, err) } msg := "no output from server" if result != nil { msg = string(result) } fmt.Printf("Installing image %s: %s\n", imageID, msg) return nil }
package main import "fmt" func main() { fmt.Println(maxSlidingWindow([]int{12, 3, 2, 4, 1}, 2)) } func maxSlidingWindow(nums []int, k int) []int { q := []int{} res := make([]int, len(nums)-k+1) for i := 0; i < len(nums); i++ { for len(q) != 0 && nums[q[len(q)-1]] < nums[i] { q = q[:len(q)-1] } q = append(q, i) if q[0] == i-k { q = q[1:] } if i+1-k >= 0 { res[i+1-k] = nums[q[0]] } } return res }
package main import ( "context" "fmt" "log" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/crypto" "strings" "github.com/sanguohot/medichain/contracts/hello" ) func main() { client, err := ethclient.Dial("http://10.6.250.55:8546") if err != nil { log.Fatal(err) return } receipt, err := client.TransactionReceipt(context.Background(), common.HexToHash("0xb4ec11e3a487dcbb64437566ad314b1648744c8ad9804008cb8d71e4449ddf8a")) if err != nil { log.Fatal(err) return } fmt.Println("receipt.Logs ===>", receipt.Logs) fmt.Println("receipt.Status ===>", receipt.Status) fmt.Println("receipt.TxHash ===>", receipt.TxHash.Hex()) contractAbi, err := abi.JSON(strings.NewReader(string(hello.HelloABI))) if err != nil { log.Fatal("abi.JSON", err) return } for _, vLog := range receipt.Logs { var event struct { NewSaying string } // 参数一是事件参数构造的对象 // 参数二是事件函数名,不是合约函数名 // 参数三是事件的数据 err := contractAbi.Unpack(&event, "onSaySomethingElse", vLog.Data) if err != nil { log.Fatal("contractAbi.Unpack", err) return } fmt.Println("event onSaySomethingElse===>", event) var topics [4]string for i := range vLog.Topics { topics[i] = vLog.Topics[i].Hex() } fmt.Println("topics ===>", topics) // 0xe79e73da417710ae99aa2088575580a60415d359acfad9cdd3382d59c80281d4 } eventSignature := []byte("onSaySomethingElse(string)") hash := crypto.Keccak256Hash(eventSignature) fmt.Println("eventSignature hash ===>", hash.Hex()) }
// Copyright (c) 2017-2018 Zededa, Inc. // SPDX-License-Identifier: Apache-2.0 package zedmanager import ( "github.com/lf-edge/eve/pkg/pillar/types" uuid "github.com/satori/go.uuid" log "github.com/sirupsen/logrus" ) func lookupVerifyImageConfig(ctx *zedmanagerContext, imageID uuid.UUID) *types.VerifyImageConfig { pub := ctx.pubAppImgVerifierConfig c, _ := pub.Get(imageID.String()) if c == nil { log.Infof("lookupVerifyImageConfig(%s) not found\n", imageID) return nil } config := c.(types.VerifyImageConfig) return &config } func lookupPersistImageConfig(ctx *zedmanagerContext, sha string) *types.PersistImageConfig { pub := ctx.pubAppImgPersistConfig c, _ := pub.Get(sha) if c == nil { log.Infof("lookupPersistImageConfig(%s) not found\n", sha) return nil } config := c.(types.PersistImageConfig) return &config } // If checkCerts is set this can return false. Otherwise not. func MaybeAddVerifyImageConfig(ctx *zedmanagerContext, uuidStr string, ss types.StorageStatus, checkCerts bool) (bool, types.ErrorInfo) { imageID := ss.ImageID log.Infof("MaybeAddVerifyImageConfig for %s, checkCerts: %v, "+ "isContainer: %v\n", imageID, checkCerts, ss.IsContainer) // check the certificate files, if not present, // we can not start verification if checkCerts { certObjStatus := lookupCertObjStatus(ctx, uuidStr) displaystr := imageID.String() ret, err := ss.IsCertsAvailable(displaystr) if err != nil { log.Fatalf("%s, invalid certificate configuration", displaystr) } if ret { if ret, errInfo := ss.HandleCertStatus(displaystr, *certObjStatus); !ret { return false, errInfo } } } m := lookupVerifyImageConfig(ctx, imageID) if m != nil { m.RefCount += 1 log.Infof("MaybeAddVerifyImageConfig: refcnt to %d for %s\n", m.RefCount, imageID) if m.IsContainer != ss.IsContainer { log.Infof("MaybeAddVerifyImageConfig: change IsContainer to %t for %s", ss.IsContainer, imageID) } m.IsContainer = ss.IsContainer if m.ImageSha256 != ss.ImageSha256 { log.Infof("MaybeAddVerifyImageConfig: change ImageSha256 to %s for %s", ss.ImageSha256, imageID) } m.ImageSha256 = ss.ImageSha256 publishVerifyImageConfig(ctx, m) } else { log.Infof("MaybeAddVerifyImageConfig: add for %s, IsContainer: %t", imageID, ss.IsContainer) n := types.VerifyImageConfig{ ImageID: ss.ImageID, VerifyConfig: types.VerifyConfig{ Name: ss.Name, ImageSha256: ss.ImageSha256, CertificateChain: ss.CertificateChain, ImageSignature: ss.ImageSignature, SignatureKey: ss.SignatureKey, }, IsContainer: ss.IsContainer, RefCount: 1, } publishVerifyImageConfig(ctx, &n) log.Debugf("MaybeAddVerifyImageConfig - config: %+v\n", n) } log.Infof("MaybeAddVerifyImageConfig done for %s\n", imageID) return true, types.ErrorInfo{} } // MaybeRemoveVerifyImageConfig decreases the refcount and if it // reaches zero the verifier might start a GC using the Expired exchange func MaybeRemoveVerifyImageConfig(ctx *zedmanagerContext, imageID uuid.UUID) { log.Infof("MaybeRemoveVerifyImageConfig for %s\n", imageID) m := lookupVerifyImageConfig(ctx, imageID) if m == nil { log.Infof("MaybeRemoveVerifyImageConfig: config missing for %s\n", imageID) return } if m.RefCount == 0 { log.Fatalf("MaybeRemoveVerifyImageConfig: Attempting to reduce "+ "0 RefCount. Image Details - Name: %s, ImageID: %s, "+ "ImageSha256:%s, IsContainer: %t", m.Name, m.ImageID, m.ImageSha256, m.IsContainer) } m.RefCount -= 1 log.Infof("MaybeRemoveVerifyImageConfig: RefCount to %d for %s\n", m.RefCount, imageID) if m.RefCount == 0 { unpublishVerifyImageConfig(ctx, m.Key()) } else { publishVerifyImageConfig(ctx, m) } log.Infof("MaybeRemoveVerifyImageConfig done for %s\n", imageID) } func publishVerifyImageConfig(ctx *zedmanagerContext, config *types.VerifyImageConfig) { key := config.Key() log.Debugf("publishVerifyImageConfig(%s)\n", key) pub := ctx.pubAppImgVerifierConfig pub.Publish(key, *config) } func unpublishVerifyImageConfig(ctx *zedmanagerContext, key string) { log.Debugf("unpublishVerifyImageConfig(%s)\n", key) pub := ctx.pubAppImgVerifierConfig pub.Unpublish(key) } func publishPersistImageConfig(ctx *zedmanagerContext, config *types.PersistImageConfig) { key := config.Key() log.Debugf("publishPersistImageConfig(%s)\n", key) pub := ctx.pubAppImgPersistConfig pub.Publish(key, *config) } func unpublishPersistImageConfig(ctx *zedmanagerContext, key string) { log.Debugf("unpublishPersistImageConfig(%s)\n", key) pub := ctx.pubAppImgPersistConfig pub.Unpublish(key) } func handleVerifyImageStatusModify(ctxArg interface{}, key string, statusArg interface{}) { status := statusArg.(types.VerifyImageStatus) ctx := ctxArg.(*zedmanagerContext) log.Infof("handleVerifyImageStatusModify for ImageID: %s, "+ " RefCount %d\n", status.ImageID, status.RefCount) // Ignore if any Pending* flag is set if status.Pending() { log.Infof("handleVerifyImageStatusModify skipped due to Pending* for"+ " ImageID: %s", status.ImageID) return } // Make sure the PersistImageConfig has the sum of the refcounts // for the sha if status.ImageSha256 != "" { updatePersistImageConfig(ctx, status.ImageSha256) } updateAIStatusWithStorageImageID(ctx, status.ImageID) log.Infof("handleVerifyImageStatusModify done for %s", status.ImageID) } // Make sure the PersistImageConfig has the sum of the refcounts // for the sha func updatePersistImageConfig(ctx *zedmanagerContext, imageSha string) { log.Infof("updatePersistImageConfig(%s)", imageSha) if imageSha == "" { return } var refcount uint sub := ctx.subAppImgVerifierStatus items := sub.GetAll() name := "" for _, s := range items { status := s.(types.VerifyImageStatus) if status.ImageSha256 == imageSha { log.Infof("Adding RefCount %d from %s to %s", status.RefCount, status.ImageID, imageSha) refcount += status.RefCount name = status.Name } } config := lookupPersistImageConfig(ctx, imageSha) if config == nil { log.Errorf("updatePersistImageConfig(%s): config not found", imageSha) if refcount == 0 { return } n := types.PersistImageConfig{ VerifyConfig: types.VerifyConfig{ Name: name, ImageSha256: imageSha, }, RefCount: 0, } config = &n } else if config.RefCount == refcount { log.Infof("updatePersistImageConfig(%s): no RefCount change %d", imageSha, refcount) return } log.Infof("updatePersistImageConfig(%s): RefCount change %d to %d", imageSha, config.RefCount, refcount) config.RefCount = refcount publishPersistImageConfig(ctx, config) } // Calculate sum of the refcounts for the config for a particular sha func sumVerifyImageRefCount(ctx *zedmanagerContext, imageSha string) uint { log.Infof("sumVerifyImageRefCount(%s)", imageSha) if imageSha == "" { return 0 } var refcount uint pub := ctx.pubAppImgVerifierConfig items := pub.GetAll() for _, c := range items { config := c.(types.VerifyImageConfig) if config.ImageSha256 == imageSha { log.Infof("Adding RefCount %d from %s to %s", config.RefCount, config.ImageID, imageSha) refcount += config.RefCount } } return refcount } // Note that this function returns the entry even if Pending* is set. func lookupVerifyImageStatus(ctx *zedmanagerContext, imageID uuid.UUID) *types.VerifyImageStatus { sub := ctx.subAppImgVerifierStatus s, _ := sub.Get(imageID.String()) if s == nil { log.Infof("lookupVerifyImageStatus(%s) not found\n", imageID) return nil } status := s.(types.VerifyImageStatus) return &status } func handleVerifyImageStatusDelete(ctxArg interface{}, key string, statusArg interface{}) { status := statusArg.(types.VerifyImageStatus) log.Infof("handleVerifyImageStatusDelete for %s\n", key) ctx := ctxArg.(*zedmanagerContext) removeAIStatusImageID(ctx, status.ImageID) // If we still publish a config with RefCount == 0 we delete it. config := lookupVerifyImageConfig(ctx, status.ImageID) if config != nil && config.RefCount == 0 { log.Infof("handleVerifyImageStatusDelete delete config for %s\n", key) unpublishVerifyImageConfig(ctx, config.Key()) } // Make sure the PersistImageConfig has the sum of the refcounts // for the sha if status.ImageSha256 != "" { updatePersistImageConfig(ctx, status.ImageSha256) } log.Infof("handleVerifyImageStatusDelete done for %s\n", key) } func lookupPersistImageStatus(ctx *zedmanagerContext, imageSha string) *types.PersistImageStatus { if imageSha == "" { return nil } sub := ctx.subAppImgPersistStatus s, _ := sub.Get(imageSha) if s == nil { log.Infof("lookupPersistImageStatus(%s) not found\n", imageSha) return nil } status := s.(types.PersistImageStatus) return &status } func handlePersistImageStatusModify(ctxArg interface{}, key string, statusArg interface{}) { status := statusArg.(types.PersistImageStatus) ctx := ctxArg.(*zedmanagerContext) log.Infof("handlePersistImageStatusModify for sha: %s, "+ " RefCount %d Expired %t", status.ImageSha256, status.RefCount, status.Expired) // We handle two special cases in the handshake here // 1. verifier added a status with RefCount=0 based on // an existing file. We echo that with a config with RefCount=0 // 2. verifier set Expired in status when garbage collecting. // If we have no RefCount we delete the config. config := lookupPersistImageConfig(ctx, status.ImageSha256) if config == nil && status.RefCount == 0 { log.Infof("handlePersistImageStatusModify adding RefCount=0 config %s\n", key) n := types.PersistImageConfig{ VerifyConfig: types.VerifyConfig{ Name: status.Name, ImageSha256: status.ImageSha256, }, RefCount: 0, } publishPersistImageConfig(ctx, &n) } else if config != nil && config.RefCount == 0 && status.Expired && sumVerifyImageRefCount(ctx, status.ImageSha256) == 0 { log.Infof("handlePersistImageStatusModify expired - deleting config %s\n", key) unpublishPersistImageConfig(ctx, config.Key()) } log.Infof("handlePersistImageStatusModify done %s\n", key) } func handlePersistImageStatusDelete(ctxArg interface{}, key string, statusArg interface{}) { status := statusArg.(types.PersistImageStatus) log.Infof("handlePersistImageStatusDelete for %s refcount %d expired %t\n", key, status.RefCount, status.Expired) ctx := ctxArg.(*zedmanagerContext) unpublishPersistImageConfig(ctx, key) log.Infof("handlePersistImageStatusDelete done %s\n", key) }
package operate import ( "strconv" "time" ) var ( bucketName string = "typora-pic-plat" ) func PutObject(path string) (string, error) { bucket, err := GetExistBucket(bucketName) var uuid string = GenUUID() var now time.Time = time.Now() var remotePath = "typora/" + strconv.Itoa(now.Local().Year()) + strconv.Itoa(int(now.Local().Month())) + strconv.Itoa(now.Local().Day()) + "/" + uuid if err != nil { HandleError(err) } return remotePath, bucket.PutObjectFromFile(remotePath, path) }
package models import ( "database/sql" "fmt" "log" ) var conn *sql.DB // Connect -> Connect to db func Connect() *sql.DB { db, err := sql.Open("mysql", "admin:admin12345@tcp(localhost:3306)/dbnotes") if err != nil { log.Fatal(err) } fmt.Println("DB Connected") conn = db return db }
package main import ( "fmt" "github.com/jdxyw/skiplist-go" ) type IntCmp struct {} func (IntCmp) Compare(rhs, lhs interface{}) int { rhsint := rhs.(int) lhsint := lhs.(int) switch result := rhsint-lhsint; { case result == 0: return 0 case result > 0: return 1 default: return -1 } } func (IntCmp) Name() string { return "Int64Comparator" } func main() { // We implement a Int64 Comaparator and pass it. // This skiplist would be use int64 as the key/value type. s := skiplist.NewSkiplist(10, IntCmp{}) // Use the Set to insert/update element in this list. // The `value` could be nil. s.Set(111, 123) s.Set(222, 234) s.Set(333, 345) s.Set(444, 456) s.Set(555, 567) fmt.Printf("The length of this skiplist is %v.\n", s.Len()) // Get value from a skiplist. val, _ := s.Get(111) fmt.Printf("The value of the key 111 in this skiplist is %v.\n", val.(int)) if _, err := s.Get(666); err != nil { fmt.Printf("The key 666 is not in this skiplist is.\n") } if s.Contains(444) == true { fmt.Println("The key 444 is exist in this skiplist.") } // Remove one key from the skiplist s.Delete(444) if s.Contains(444) == false { fmt.Println("The key 444 has been removed from this skiplist.") } }
package csidh import ( "crypto/rand" "testing" "github.com/cloudflare/circl/dh/csidh" "github.com/stretchr/testify/require" ) func TestCSIDH(t *testing.T) { // Alice alicePrivateKey := new(csidh.PrivateKey) err := csidh.GeneratePrivateKey(alicePrivateKey, rand.Reader) require.NoError(t, err) alicePrivateKeyBytes := make([]byte, csidh.PrivateKeySize) require.True(t, alicePrivateKey.Export(alicePrivateKeyBytes)) t.Logf("Alice's private key: %x", alicePrivateKeyBytes) alicePublicKey := new(csidh.PublicKey) csidh.GeneratePublicKey(alicePublicKey, alicePrivateKey, rand.Reader) require.True(t, csidh.Validate(alicePublicKey, rand.Reader)) alicePublicKeyBytes := make([]byte, csidh.PublicKeySize) require.True(t, alicePublicKey.Export(alicePublicKeyBytes)) t.Logf("Alice's public key: %x", alicePublicKeyBytes) // Bob bobPrivateKey := new(csidh.PrivateKey) err = csidh.GeneratePrivateKey(bobPrivateKey, rand.Reader) require.NoError(t, err) bobPrivateKeyBytes := make([]byte, csidh.PrivateKeySize) require.True(t, bobPrivateKey.Export(bobPrivateKeyBytes)) t.Logf("Bob's private key: %x", bobPrivateKeyBytes) bobPublicKey := new(csidh.PublicKey) csidh.GeneratePublicKey(bobPublicKey, bobPrivateKey, rand.Reader) require.True(t, csidh.Validate(bobPublicKey, rand.Reader)) bobPublicKeyBytes := make([]byte, csidh.PublicKeySize) require.True(t, bobPublicKey.Export(bobPublicKeyBytes)) t.Logf("Bob's public key: %x", bobPublicKeyBytes) // Alice sends her public key to Bob over an authenticated channel // and Bob computes their shared secret: bobSharedSecret := [csidh.SharedSecretSize]byte{} require.True(t, csidh.DeriveSecret(&bobSharedSecret, alicePublicKey, bobPrivateKey, rand.Reader)) // Bob sends his public key to Alice over an authenticated channel // and Alice computes their shared secret: aliceSharedSecret := [csidh.SharedSecretSize]byte{} require.True(t, csidh.DeriveSecret(&aliceSharedSecret, bobPublicKey, alicePrivateKey, rand.Reader)) require.Equal(t, aliceSharedSecret, bobSharedSecret) t.Logf("Shared secret: %x", aliceSharedSecret[:]) }
/* A function takes in two hashes as input. Both hashes contain exactly the same keys. Return an array of keys where the values in each hash differs. Examples differs({a: 1, b: 2, c: 3}, {a: 3, b: 2, c: 1}) ➞ ["a", "c"] differs({a: 1, b: 1, c: 1}, {a: 2, b: 2, c: 2}) ➞ ["a", "b", "c"] differs({a: 3, b: 3, c: 3}, {a: 3, b: 3, c: 3}) ➞ [] Notes N/A */ package main import ( "reflect" "sort" ) func main() { test(map[string]int{"a": 1, "b": 2, "c": 3}, map[string]int{"a": 3, "b": 2, "c": 1}, []string{"a", "c"}) test(map[string]int{"a": 1, "b": 1, "c": 1}, map[string]int{"a": 2, "b": 2, "c": 2}, []string{"a", "b", "c"}) test(map[string]int{"a": 3, "b": 3, "c": 3}, map[string]int{"a": 3, "b": 3, "c": 3}, []string{}) } func test(m, n map[string]int, r []string) { assert(reflect.DeepEqual(differs(m, n), r)) } func assert(x bool) { if !x { panic("assertion failed") } } func differs(m, n map[string]int) []string { p := []string{} for k := range m { if m[k] != n[k] { p = append(p, k) } } sort.Strings(p) return p }
package cmd import ( "errors" "fmt" "os" "path/filepath" "strings" "gonum.org/v1/gonum/spatial/r3" ) type OBJ struct { V []r3.Vec //VT []r2.Vec //VN []r3.Vec FS []OBJF } type OBJF struct { Mtl string F []OBJFV } type OBJFV struct { V int } func (o *OBJ) Export(path string) error { if !strings.HasSuffix(path, ".obj") { return errors.New("are") } mtlPath := path[:len(path)-4] + ".mtl" obj, err := os.Create(path) if err != nil { return err } defer obj.Close() mtl, err := os.Create(mtlPath) if err != nil { return err } defer mtl.Close() fmt.Fprintf(obj, "mtllib %v\n", filepath.Base(mtlPath)) for _, v := range o.V { fmt.Fprintf(obj, "v %.6f %.6f %.6f\n", v.Y, -v.X, v.Z) } mats := make(map[string]struct{}) for _, fs := range o.FS { fmt.Fprintf(obj, "usemtl %v\n", fs.Mtl) fmt.Fprintf(obj, "f") for i := len(fs.F) - 1; i >= 0; i-- { f := fs.F[i] fmt.Fprintf(obj, " %v", f.V) } fmt.Fprintln(obj) mats[fs.Mtl] = struct{}{} } for mat := range mats { fmt.Fprintf(mtl, "newmtl %v\n", mat) } return nil }
package config import ( "github.com/apex/log" "github.com/caarlos0/env" ) type Config struct { Port string `env:"PORT" envDefault:"8081"` AllowedOrigins []string `env:"ALLOWED_ORIGINS" envSeparator:"," envDefault:"*"` } func MustGet() Config { var cfg Config if err := env.Parse(&cfg); err != nil { log.WithError(err).Fatal("failed to load config") } return cfg }
package v039 import ( "fmt" "strings" sdk "github.com/cosmos/cosmos-sdk/types" ) // NameRecord is an address with a flag that indicates if the name is restricted type NameRecord struct { // The bound name Name string `json:"name" yaml:"name"` // The address the name resolved to. Address sdk.AccAddress `json:"address" yaml:"address"` // Whether owner signature is required to add sub-names. Restricted bool `json:"restricted,omitempty" yaml:"restricted"` // The value exchange address Pointer sdk.AccAddress `json:"pointer,omitempty" yaml:"pointer"` } // NewNameRecord creates a name record binding that is restricted for child updates to the owner. func NewNameRecord(name string, address sdk.AccAddress, restricted bool) NameRecord { return NameRecord{ Name: name, Address: address, Restricted: restricted, } } // implement fmt.Stringer func (nr NameRecord) String() string { if nr.Restricted { return strings.TrimSpace(fmt.Sprintf(`%s: %s [restricted]`, nr.Name, nr.Address)) } return strings.TrimSpace(fmt.Sprintf(`%s: %s`, nr.Name, nr.Address)) } // NameRecords within the GenesisState type NameRecords []NameRecord // GenesisState is the initial set of name -> address bindings. type GenesisState struct { Bindings NameRecords `json:"bindings"` }
// RAINBOND, Application Management Platform // Copyright (C) 2014-2017 Goodrain Co., Ltd. // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. For any non-GPL usage of Rainbond, // one or multiple Commercial Licenses authorized by Goodrain Co., Ltd. // must be obtained first. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. package server import ( "fmt" "net" "strings" "github.com/prometheus/common/log" ) //UDPServer udp server type UDPServer struct { ListenerHost string ListenerPort int } //Server 服务 func (u *UDPServer) Server(ch chan error) { listener, err := net.ListenUDP("udp", &net.UDPAddr{IP: net.ParseIP(u.ListenerHost), Port: u.ListenerPort}) if err != nil { fmt.Println(err) ch <- err return } log.Infof("UDP Server Listener: %s", listener.LocalAddr().String()) buf := make([]byte, 65535) for { n, _, err := listener.ReadFromUDP(buf) if err != nil { ch <- err return } u.handlePacket(buf[0:n]) } } func (u *UDPServer) handlePacket(packet []byte) { lines := strings.Split(string(packet), "\n") for _, line := range lines { if line != "" { fmt.Println("Message:" + line) } } }
package models import ( . "asdf" "github.com/astaxie/beego" "github.com/astaxie/beego/logs" "radgo" "strconv" "strings" ) //************************************************ //以下为实现radgo的logger的接口 //************************************************ type mylog struct { log *logs.BeeLogger } var log mylog func (me *mylog) Emerg(format string, v ...interface{}) { me.log.Emergency(format, v...) } func (me *mylog) Alert(format string, v ...interface{}) { me.log.Alert(format, v...) } func (me *mylog) Crit(format string, v ...interface{}) { me.log.Critical(format, v...) } func (me *mylog) Error(format string, v ...interface{}) { me.log.Error(format, v...) } func (me *mylog) Warning(format string, v ...interface{}) { me.log.Warning(format, v...) } func (me *mylog) Notice(format string, v ...interface{}) { me.log.Notice(format, v...) } func (me *mylog) Info(format string, v ...interface{}) { me.log.Informational(format, v...) } func (me *mylog) Debug(format string, v ...interface{}) { me.log.Debug(format, v...) } //************************************************************ //以下为实现radgo的IAuth IAcct IParam接口 //************************************************************ type RadUser struct { User *UserStatus } // IAuth func (user *RadUser) UserPassword() []byte { return []byte(user.User.AuthCode) } // IAcct func (user *RadUser) SSID() []byte { return []byte(user.User.Ssid) } // IAcct func (user *RadUser) DevMac() []byte { return user.User.devmac[:] } // IAcct func (user *RadUser) SessionId() []byte { // return user session // when new user, use ClientSessionId init session return []byte(user.User.RadSession) } // IAcct func (user *RadUser) UserName() []byte { a := []string{user.User.UserName, "@windfind.static@ish"} b := strings.Join(a, "") beego.Debug("radgo.go.85 username=", b) return []byte(b) } // IAcct func (user *RadUser) UserMac() []byte { return user.User.usermac[:] } // IAcct func (user *RadUser) UserIp() uint32 { return uint32(user.User.userip) } // IAcct func (user *RadUser) AcctInputOctets() uint32 { return uint32(user.User.FlowUp & 0xffffffff) } // IAcct func (user *RadUser) AcctOutputOctets() uint32 { return uint32(user.User.FlowDown & 0xffffffff) } // IAcct func (user *RadUser) AcctInputGigawords() uint32 { return uint32(user.User.FlowUp >> 32) } // IAcct func (user *RadUser) AcctOutputGigawords() uint32 { return uint32(user.User.FlowDown >> 32) } // IAcct func (user *RadUser) AcctTerminateCause() uint32 { return radgo.DeauthReason(user.User.Reason).TerminateCause() } // IAcct func (user *RadUser) GetClass() []byte { beego.Debug("Recived Radclass =", user.User.RadClass) return []byte(user.User.RadClass) } // IAcct func (user *RadUser) SetClass(c []byte) { user.User.RadClass = string(c) beego.Debug("Recived Radclass =", user.User.RadClass) beego.Debug("Recived Radclass =", user.User.RadClass) } // IAcct func (user *RadUser) GetChapChallenge() []byte { return user.User.challenge } // IAcct func (user *RadUser) SetChapChallenge(c []byte) { user.User.challenge = c user.User.encode() } // IParam func (user *RadUser) Secret() []byte { return []byte(param.RadSecret) } // IParam func (user *RadUser) NasIdentifier() []byte { //passwd for redius in configure return []byte(param.NasIdentifier) } // IParam func (user *RadUser) NasIpAddress() uint32 { return uint32(param.NasIpAddress) } // IParam func (user *RadUser) NasPort() uint32 { return param.NasPort } // IParam func (user *RadUser) NasPortType() uint32 { return uint32(radgo.AnptIeee80211) } // IParam func (user *RadUser) ServiceType() uint32 { return uint32(radgo.AstLogin) } // IParam func (user *RadUser) AuthType() uint32 { return param.AuthType } // IParam func (user *RadUser) Server() string { return param.RadServer } // IParam func (user *RadUser) AuthPort() string { return param.AuthPort } // IParam func (user *RadUser) AcctPort() string { return param.AcctPort } // IParam func (user *RadUser) DmPort() string { return param.DmPort } // IParam func (user *RadUser) Timeout() uint32 { return param.RadTimeout } type radParam struct { RadSecret string NasIdentifier string RadServer string AuthPort string AcctPort string DmPort string NasIpAddress IpAddress NasPort uint32 RadTimeout uint32 AuthType uint32 } var param = &radParam{} func radParamString(name string) string { return beego.AppConfig.String(name) } func radParamUint32(name string) uint32 { i, _ := strconv.Atoi(radParamString(name)) return uint32(i) } func radParamIpAddress(name string) IpAddress { return IpAddressFromString(radParamString(name)) } func radParamInit() { param.RadSecret = radParamString("RadSecret") param.NasIdentifier = radParamString("NasIdentifier") param.RadServer = radParamString("RadServer") param.AuthPort = radParamString("AuthPort") param.AcctPort = radParamString("AcctPort") param.DmPort = radParamString("DmPort") param.NasIpAddress = radParamIpAddress("NasIpAddress") param.AuthType = radParamUint32("AuthType") param.NasPort = radParamUint32("NasPort") param.RadTimeout = radParamUint32("RadTimeout") }
package postgres import ( "context" "fmt" "github.com/google/uuid" "github.com/odpf/optimus/models" "github.com/odpf/optimus/store" "github.com/pkg/errors" "gorm.io/gorm" ) type ProjectJobSpecRepository struct { db *gorm.DB project models.ProjectSpec adapter *JobSpecAdapter } func NewProjectJobSpecRepository(db *gorm.DB, project models.ProjectSpec, adapter *JobSpecAdapter) *ProjectJobSpecRepository { return &ProjectJobSpecRepository{ db: db, project: project, adapter: adapter, } } func (repo *ProjectJobSpecRepository) GetByName(ctx context.Context, name string) (models.JobSpec, models.NamespaceSpec, error) { var r Job if err := repo.db.WithContext(ctx).Preload("Namespace").Where("project_id = ? AND name = ?", repo.project.ID, name).First(&r).Error; err != nil { if errors.Is(err, gorm.ErrRecordNotFound) { return models.JobSpec{}, models.NamespaceSpec{}, store.ErrResourceNotFound } return models.JobSpec{}, models.NamespaceSpec{}, err } jobSpec, err := repo.adapter.ToSpec(r) if err != nil { return models.JobSpec{}, models.NamespaceSpec{}, err } namespaceSpec, err := r.Namespace.ToSpec(repo.project) if err != nil { return models.JobSpec{}, models.NamespaceSpec{}, err } return jobSpec, namespaceSpec, nil } func (repo *ProjectJobSpecRepository) GetAll(ctx context.Context) ([]models.JobSpec, error) { specs := []models.JobSpec{} jobs := []Job{} if err := repo.db.WithContext(ctx).Where("project_id = ?", repo.project.ID).Find(&jobs).Error; err != nil { return specs, err } for _, job := range jobs { adapt, err := repo.adapter.ToSpec(job) if err != nil { return specs, err } specs = append(specs, adapt) } return specs, nil } func (repo *ProjectJobSpecRepository) GetByNameForProject(ctx context.Context, projName string, jobName string) (models.JobSpec, models.ProjectSpec, error) { var r Job var p Project if err := repo.db.WithContext(ctx).Where("name = ?", projName).First(&p).Error; err != nil { if errors.Is(err, gorm.ErrRecordNotFound) { return models.JobSpec{}, models.ProjectSpec{}, errors.Wrap(store.ErrResourceNotFound, "project not found") } return models.JobSpec{}, models.ProjectSpec{}, err } if err := repo.db.WithContext(ctx).Where("project_id = ? AND name = ?", p.ID, jobName).First(&r).Error; err != nil { if errors.Is(err, gorm.ErrRecordNotFound) { return models.JobSpec{}, models.ProjectSpec{}, errors.Wrap(store.ErrResourceNotFound, "job spec not found") } return models.JobSpec{}, models.ProjectSpec{}, err } jSpec, err := repo.adapter.ToSpec(r) if err != nil { return models.JobSpec{}, models.ProjectSpec{}, err } pSpec, err := p.ToSpec() if err != nil { return models.JobSpec{}, models.ProjectSpec{}, err } return jSpec, pSpec, err } func (repo *ProjectJobSpecRepository) GetByDestination(ctx context.Context, destination string) (models.JobSpec, models.ProjectSpec, error) { var r Job if err := repo.db.WithContext(ctx).Preload("Project").Where("destination = ?", destination).First(&r).Error; err != nil { if errors.Is(err, gorm.ErrRecordNotFound) { return models.JobSpec{}, models.ProjectSpec{}, store.ErrResourceNotFound } return models.JobSpec{}, models.ProjectSpec{}, err } jSpec, err := repo.adapter.ToSpec(r) if err != nil { return models.JobSpec{}, models.ProjectSpec{}, err } pSpec, err := r.Project.ToSpec() if err != nil { return models.JobSpec{}, models.ProjectSpec{}, err } return jSpec, pSpec, err } type JobSpecRepository struct { db *gorm.DB namespace models.NamespaceSpec projectJobSpecRepo store.ProjectJobSpecRepository adapter *JobSpecAdapter } func (repo *JobSpecRepository) Insert(ctx context.Context, spec models.JobSpec) error { resource, err := repo.adapter.FromSpecWithNamespace(spec, repo.namespace) if err != nil { return err } if len(resource.Name) == 0 { return errors.New("name cannot be empty") } // if soft deleted earlier if err := repo.HardDelete(ctx, spec.Name); err != nil { return err } return repo.db.WithContext(ctx).Create(&resource).Error } func (repo *JobSpecRepository) Save(ctx context.Context, spec models.JobSpec) error { // while saving a JobSpec, we need to ensure that it's name is unique for a project existingJobSpec, namespaceSpec, err := repo.projectJobSpecRepo.GetByName(ctx, spec.Name) if errors.Is(err, store.ErrResourceNotFound) { return repo.Insert(ctx, spec) } else if err != nil { return errors.Wrap(err, "unable to retrieve spec by name") } if namespaceSpec.ID != repo.namespace.ID { return errors.New(fmt.Sprintf("job %s already exists for the project %s", spec.Name, repo.namespace.ProjectSpec.Name)) } resource, err := repo.adapter.FromJobSpec(spec) if err != nil { return err } resource.ID = existingJobSpec.ID return repo.db.WithContext(ctx).Model(&resource).Updates(&resource).Error } func (repo *JobSpecRepository) GetByID(ctx context.Context, id uuid.UUID) (models.JobSpec, error) { var r Job if err := repo.db.WithContext(ctx).Where("namespace_id = ? AND id = ?", repo.namespace.ID, id).First(&r).Error; err != nil { if errors.Is(err, gorm.ErrRecordNotFound) { return models.JobSpec{}, store.ErrResourceNotFound } return models.JobSpec{}, err } return repo.adapter.ToSpec(r) } func (repo *JobSpecRepository) GetByName(ctx context.Context, name string) (models.JobSpec, error) { var r Job if err := repo.db.WithContext(ctx).Where("namespace_id = ? AND name = ?", repo.namespace.ID, name).First(&r).Error; err != nil { if errors.Is(err, gorm.ErrRecordNotFound) { return models.JobSpec{}, store.ErrResourceNotFound } return models.JobSpec{}, err } return repo.adapter.ToSpec(r) } func (repo *JobSpecRepository) Delete(ctx context.Context, name string) error { return repo.db.WithContext(ctx).Where("namespace_id = ? AND name = ?", repo.namespace.ID, name).Delete(&Job{}).Error } func (repo *JobSpecRepository) HardDelete(ctx context.Context, name string) error { // find the base job var r Job if err := repo.db.WithContext(ctx).Unscoped().Where("project_id = ? AND name = ?", repo.namespace.ProjectSpec.ID, name).Find(&r).Error; err == gorm.ErrRecordNotFound { // no job exists, inserting for the first time return nil } else if err != nil { return errors.Wrap(err, "failed to fetch soft deleted resource") } return repo.db.WithContext(ctx).Unscoped().Where("id = ?", r.ID).Delete(&Job{}).Error } func (repo *JobSpecRepository) GetAll(ctx context.Context) ([]models.JobSpec, error) { var specs []models.JobSpec var jobs []Job if err := repo.db.WithContext(ctx).Where("namespace_id = ?", repo.namespace.ID).Find(&jobs).Error; err != nil { return specs, err } for _, job := range jobs { adapt, err := repo.adapter.ToSpec(job) if err != nil { return specs, err } specs = append(specs, adapt) } return specs, nil } func NewJobSpecRepository(db *gorm.DB, namespace models.NamespaceSpec, projectJobSpecRepo store.ProjectJobSpecRepository, adapter *JobSpecAdapter) *JobSpecRepository { return &JobSpecRepository{ db: db, namespace: namespace, projectJobSpecRepo: projectJobSpecRepo, adapter: adapter, } }
package conf const ( DEFAULT_READ_TIMEOUT int = 5000 DEFAULT_WRITE_TIMEOUT int = 5000 DEFAULT_HANDLE_TIMEOUT int = 5000 ) // APP配置 type AppConfig struct { Addr string `toml:"listen"` // 监听地址 ReadTimeout int `toml:"readTimeout"` // 请求读超时 HandleTimeout int `toml:"handleTimeout"` // 请求处理超时 WriteTimeout int `toml:"writeTimeout"` // 请求写超时 } // 默认App配置 func DefaultAppConfig() (appConfig *AppConfig) { appConfig = &AppConfig{ ReadTimeout: DEFAULT_READ_TIMEOUT, HandleTimeout: DEFAULT_HANDLE_TIMEOUT, WriteTimeout: DEFAULT_WRITE_TIMEOUT, } return }
package golang import "github.com/crozz-chen/apimeta/meta" type File struct { Path string Pkg string FullPkg string Refs []Ref Models []meta.Model Apis []meta.Api } // com.apimeta.user type Ref struct { Src string // @(com/apimeta/user) Pkg string // apimeta FullPkg string // com/apimeta Alias string // apimeta_1 Name string // User File string // com/apimeta.go }
package rp import ( "encoding/xml" "errors" "fmt" "io/ioutil" "os" "path/filepath" "sort" "strings" "time" ) // XMLReport identifies JUnit XML format specification that Hudson supports type XMLReport struct { xmlSuites []xmlSuite } type xmlSuite struct { XMLName string `xml:"testsuite"` ID int `xml:"id,attr"` Name string `xml:"name,attr"` PackageName string `xml:"package,attr"` TimeStamp string `xml:"timestamp,attr"` Time float64 `xml:"time,attr"` HostName string `xml:"hostname,attr"` Tests int `xml:"tests,attr"` Failures int `xml:"failures,attr"` Errors int `xml:"errors,attr"` Skipped int `xml:"skipped,attr"` Properties xmlProperties `xml:"properties"` Cases []xmlTest `xml:"testcase"` SystemOut string `xml:"system-out"` SystemErr string `xml:"system-err"` } type xmlProperties struct { } type xmlTest struct { Name string `xml:"name,attr"` ClassName string `xml:"classname,attr"` Time float64 `xml:"time,attr"` Failure *xmlFailure `xml:"failure,omitempty"` Skipped *xmlSkipped `xml:"skipped,omitempty"` } type xmlFailure struct { Type string `xml:"type,attr"` Message string `xml:"message,attr"` Details string `xml:",chardata"` } type xmlSkipped struct { Message string `xml:"message,attr"` } // LoadXMLReport is used for loading JUnit XML report from specified directory func LoadXMLReport(dirName string) (*XMLReport, error) { report, err := parseXMLReport(dirName) if err != nil { return nil, err } return &XMLReport{ xmlSuites: report, }, nil } // SuitesCount provides suite count for current xml test result report func (report *XMLReport) SuitesCount() int { return len(report.xmlSuites) } // TesCaseCount provides test case count for current suite func (report *XMLReport) TesCaseCount(i int) int { return len(report.xmlSuites[i].Cases) } // LaunchStartTime is used to calc launch time, it will be equal to 0 suite start time func (report *XMLReport) LaunchStartTime() time.Time { return parseTimeStamp(report.xmlSuites[0].TimeStamp) } // LaunchEndTime is used to calc launch end time, it will be equal to last suite start time plus last suite duration func (report *XMLReport) LaunchEndTime() time.Time { lastIndex := len(report.xmlSuites) - 1 lastSuiteStart := parseTimeStamp(report.xmlSuites[lastIndex].TimeStamp) d := secondsToDuration(report.xmlSuites[lastIndex].Time) return lastSuiteStart.Add(d) } // Suite is used ot create new TestItem type SUITE for xml suite func (report *XMLReport) Suite(i int) *TestItem { xSuite := report.xmlSuites[i] suiteStart := parseTimeStamp(xSuite.TimeStamp) xSuiteNames := []string{xSuite.PackageName, xSuite.Name} return &TestItem{ Type: TestItemTypeSuite, StartTime: suiteStart, Name: strings.Join(xSuiteNames, "."), Description: fmt.Sprintf("%s %d", TestItemTypeSuite, xSuite.ID), } } // SuiteResult is used ot create new ExecutionResult for xml suite func (report *XMLReport) SuiteResult(i int) *ExecutionResult { xSuite := report.xmlSuites[i] suiteStart := parseTimeStamp(xSuite.TimeStamp) t := xSuite.Time if t <= 0 { t = 00.1 } d := secondsToDuration(t) suiteEnd := suiteStart.Add(d) status := ExecutionStatusPassed if xSuite.Tests == 0 { status = ExecutionStatusSkipped } else if xSuite.Failures > 0 { status = ExecutionStatusFailed } else if xSuite.Errors > 0 { status = ExecutionStatusFailed } return &ExecutionResult{ EndTime: suiteEnd, Status: status, } } // TestCase is used ot create new TestItem type STEP for xml test case func (report *XMLReport) TestCase(i, j int) *TestItem { xSuite := report.xmlSuites[i] suiteStart := parseTimeStamp(xSuite.TimeStamp) xCase := xSuite.Cases[j] return &TestItem{ Type: TestItemTypeStep, Name: xCase.Name, StartTime: suiteStart, // FixMe } } // TestCaseResult is used ot create new ExecutionResult for xml test case func (report *XMLReport) TestCaseResult(i, j int) *ExecutionResult { xSuite := report.xmlSuites[i] suiteStart := parseTimeStamp(xSuite.TimeStamp) xCase := xSuite.Cases[j] t := xCase.Time if t <= 0 { t = 00.1 } d := secondsToDuration(t) xCaseEnd := suiteStart.Add(d) var status = ExecutionStatusPassed if xCase.Failure != nil { status = ExecutionStatusFailed } if xCase.Skipped != nil { status = ExecutionStatusSkipped } return &ExecutionResult{ EndTime: xCaseEnd, Status: status, } } // HasTestCaseSkipped is used to check xml skipped value for given xml suite and test case func (report *XMLReport) HasTestCaseSkipped(i, j int) bool { return report.xmlSuites[i].Cases[j].Skipped != nil } // HasTestCaseFailure is used to check xml failure for given xml suite and test case func (report *XMLReport) HasTestCaseFailure(i, j int) bool { return report.xmlSuites[i].Cases[j].Failure != nil } // TestCaseFailure is used to create new LogMessage with failure message for given xml suite and test case func (report *XMLReport) TestCaseFailure(i, j int) *LogMessage { xSuite := report.xmlSuites[i] suiteStart := parseTimeStamp(xSuite.TimeStamp) xCase := xSuite.Cases[j] t := xCase.Time if t <= 0 { t = 00.1 } d := secondsToDuration(t) xCaseEnd := suiteStart.Add(d) return &LogMessage{ Time: xCaseEnd, Level: LogLevelError, Message: xCase.Failure.Message, } } // TesCaseSkippedMessage is used to create new Log Message with skiped message for given xml suite and test case func (report *XMLReport) TesCaseSkippedMessage(i, j int) *LogMessage { xSuite := report.xmlSuites[i] suiteStart := parseTimeStamp(xSuite.TimeStamp) xCase := xSuite.Cases[j] t := xCase.Time if t <= 0 { t = 00.1 } d := secondsToDuration(t) xCaseEnd := suiteStart.Add(d) return &LogMessage{ Time: xCaseEnd, Level: LogLevelInfo, Message: xCase.Skipped.Message, } } // TestCaseFailureDetails is used to create new LogMessage with failure details for given xml suite and test case func (report *XMLReport) TestCaseFailureDetails(i, j int) *LogMessage { xSuite := report.xmlSuites[i] suiteStart := parseTimeStamp(xSuite.TimeStamp) xCase := xSuite.Cases[j] d := secondsToDuration(xCase.Time) xCaseEnd := suiteStart.Add(d) return &LogMessage{ Time: xCaseEnd, Level: LogLevelInfo, Message: xCase.Failure.Details, } } // parseXMLReport is used for parsing xml report sorted by suite start time func parseXMLReport(reportDir string) ([]xmlSuite, error) { if len(reportDir) == 0 { return nil, errors.New("report dir could not be empty") } files := []string{} filepath.Walk(reportDir, func(path string, f os.FileInfo, err error) error { if filepath.Ext(f.Name()) != ".xml" || f.IsDir() { log.Debugf("not report file '%s'", f.Name()) } else { files = append(files, path) } return nil }) n := len(files) xSuites := make([]xmlSuite, 0) for i := 0; i < n; i++ { f := files[i] xmlFile, err := os.Open(f) defer xmlFile.Close() if err != nil { log.Error(err) continue } b, err := ioutil.ReadAll(xmlFile) if err != nil { log.Error(err) continue } var xSuite xmlSuite err = xml.Unmarshal(b, &xSuite) if err != nil { log.Error(err) continue } xSuites = append(xSuites, xSuite) } // sort by start time sort.Slice(xSuites, func(i, j int) bool { t1 := parseTimeStamp(xSuites[i].TimeStamp) t2 := parseTimeStamp(xSuites[j].TimeStamp) return t1.Before(t2) }) return xSuites, nil }
package roleTypeRole import ( "google.golang.org/appengine/datastore" ) // RoleTypeRole datastore: ",noindex" causes json naming problems !!!!!!!!!!!!!!!!!!!!!!!!!!!!! // "Role" key is the parent key. type RoleTypeRole struct { RoleTypeKey *datastore.Key } // RoleTypeRoles is a []*RoleTypeRole type RoleTypeRoles []*RoleTypeRole
package main import ( "os" "strconv" ) func flib(index, max, l1, l2 int) int { if index == max { return l2 } return flib(index+1, max, l2, l1+l2) } func f(n int) int { if n == 0 { return 0 } else if n == 1 { return 1 } else { return f(n-1) + f(n-2) } } func main() { max, _ := strconv.Atoi(os.Args[1]) if max == 1 { println("index1: \n", max) println("value1: \n", 1) return } if max == 2 { println("index1: \n", max) println("value1: \n", 1) return } sum := flib(3, max, 1, 2) println("index1: ", max) println("value1: ", sum) sum = f(max) println("index2: ", max) println("value2: ", sum) }
package model import ( "errors" "fmt" "gopkg.in/macaron.v1" "gopkg.in/mgo.v2" "log" "tech/modules/setting" "time" //"os" ) const ( MasterSession = "master" MonotonicSession = "monotonic" ) var ( singleton mongoManager ) type ( mongoConfiguration struct { Hosts string Database string Username string Password string Port int } mongoSession struct { mongoDialInfo *mgo.DialInfo mongoSession *mgo.Session } mongoManager struct { sessions map[string]mongoSession } DBCall func(*mgo.Collection) error ) func init() { if singleton.sessions != nil { return } singleton = mongoManager{ sessions: make(map[string]mongoSession), } if err := CreateSession("monotonic", MonotonicSession, setting.DbHost, setting.DbName, setting.DbUser, setting.DbPass); err != nil { log.Fatalf("mongodb connection failed : %v", err) } if macaron.Env == macaron.DEV { //mgo.SetDebug(true) //var Logger *log.Logger //Logger = log.New(os.Stdout ,"mgo" , log.LstdFlags) //mgo.SetLogger(Logger) } fmt.Println("create session success") } func CreateSession(mode string, sessionName string, host []string, databaseName string, username string, password string) error { mongoSession := mongoSession{ mongoDialInfo: &mgo.DialInfo{ Addrs: host, Timeout: 10 * time.Second, Database: databaseName, Username: username, Password: password, }, } var err error mongoSession.mongoSession, err = mgo.DialWithInfo(mongoSession.mongoDialInfo) if err != nil { return err } switch mode { case "strong": mongoSession.mongoSession.SetMode(mgo.Strong, true) case "monotonic": mongoSession.mongoSession.SetMode(mgo.Monotonic, true) } mongoSession.mongoSession.SetSafe(&mgo.Safe{}) singleton.sessions[sessionName] = mongoSession return nil } func CopySession(useSession string) (*mgo.Session, error) { session := singleton.sessions[useSession] if session.mongoSession == nil { return nil, errors.New("unable to Locate Session " + useSession) } mongoSession := session.mongoSession.Copy() return mongoSession, nil } func GetDB() *mgo.Database { m, err := CopySession(MonotonicSession) if err != nil { log.Fatal("unable to get db") } return m.DB(setting.DbName) }
package zmq4_test import ( zmq "github.com/pebbe/zmq4" "errors" "fmt" "runtime" "strconv" "time" ) var ( errerr = errors.New("error") ) func Example_test_version() { major, _, _ := zmq.Version() fmt.Println("Version:", major) // Output: // Version: 4 } func Example_multiple_contexts() { chQuit := make(chan interface{}) chReactor := make(chan bool) addr1 := "tcp://127.0.0.1:9997" addr2 := "tcp://127.0.0.1:9998" serv_ctx1, err := zmq.NewContext() if checkErr(err) { return } serv1, err := serv_ctx1.NewSocket(zmq.REP) if checkErr(err) { return } err = serv1.Bind(addr1) if checkErr(err) { return } defer func() { serv1.Close() serv_ctx1.Term() }() serv_ctx2, err := zmq.NewContext() if checkErr(err) { return } serv2, err := serv_ctx2.NewSocket(zmq.REP) if checkErr(err) { return } err = serv2.Bind(addr2) if checkErr(err) { return } defer func() { serv2.Close() serv_ctx2.Term() }() new_service := func(sock *zmq.Socket, addr string) { socket_handler := func(state zmq.State) error { msg, err := sock.RecvMessage(0) if checkErr(err) { return err } _, err = sock.SendMessage(addr, msg) if checkErr(err) { return err } return nil } quit_handler := func(interface{}) error { return errors.New("quit") } defer func() { chReactor <- true }() reactor := zmq.NewReactor() reactor.AddSocket(sock, zmq.POLLIN, socket_handler) reactor.AddChannel(chQuit, 1, quit_handler) err = reactor.Run(100 * time.Millisecond) fmt.Println(err) } go new_service(serv1, addr1) go new_service(serv2, addr2) time.Sleep(time.Second) // default context sock1, err := zmq.NewSocket(zmq.REQ) if checkErr(err) { return } sock2, err := zmq.NewSocket(zmq.REQ) if checkErr(err) { return } err = sock1.Connect(addr1) if checkErr(err) { return } err = sock2.Connect(addr2) if checkErr(err) { return } _, err = sock1.SendMessage(addr1) if checkErr(err) { return } _, err = sock2.SendMessage(addr2) if checkErr(err) { return } msg, err := sock1.RecvMessage(0) fmt.Println(err, msg) msg, err = sock2.RecvMessage(0) fmt.Println(err, msg) err = sock1.Close() if checkErr(err) { return } err = sock2.Close() if checkErr(err) { return } // non-default contexts ctx1, err := zmq.NewContext() if checkErr(err) { return } ctx2, err := zmq.NewContext() if checkErr(err) { return } sock1, err = ctx1.NewSocket(zmq.REQ) if checkErr(err) { return } sock2, err = ctx2.NewSocket(zmq.REQ) if checkErr(err) { return } err = sock1.Connect(addr1) if checkErr(err) { return } err = sock2.Connect(addr2) if checkErr(err) { return } _, err = sock1.SendMessage(addr1) if checkErr(err) { return } _, err = sock2.SendMessage(addr2) if checkErr(err) { return } msg, err = sock1.RecvMessage(0) fmt.Println(err, msg) msg, err = sock2.RecvMessage(0) fmt.Println(err, msg) err = sock1.Close() if checkErr(err) { return } err = sock2.Close() if checkErr(err) { return } err = ctx1.Term() if checkErr(err) { return } err = ctx2.Term() if checkErr(err) { return } // close(chQuit) doesn't work because the reactor removes closed channels, instead of acting on them chQuit <- true <-chReactor chQuit <- true <-chReactor fmt.Println("Done") // Output: // <nil> [tcp://127.0.0.1:9997 tcp://127.0.0.1:9997] // <nil> [tcp://127.0.0.1:9998 tcp://127.0.0.1:9998] // <nil> [tcp://127.0.0.1:9997 tcp://127.0.0.1:9997] // <nil> [tcp://127.0.0.1:9998 tcp://127.0.0.1:9998] // quit // quit // Done } func Example_test_abstract_ipc() { addr := "ipc://@/tmp/tester" // This is Linux only if runtime.GOOS != "linux" { fmt.Printf("%q\n", addr) fmt.Println("Done") return } sb, err := zmq.NewSocket(zmq.PAIR) if checkErr(err) { return } err = sb.Bind(addr) if checkErr(err) { return } endpoint, err := sb.GetLastEndpoint() if checkErr(err) { return } fmt.Printf("%q\n", endpoint) sc, err := zmq.NewSocket(zmq.PAIR) if checkErr(err) { return } err = sc.Connect(addr) if checkErr(err) { return } bounce(sb, sc, false) err = sc.Close() if checkErr(err) { return } err = sb.Close() if checkErr(err) { return } fmt.Println("Done") // Output: // "ipc://@/tmp/tester" // Done } func Example_test_conflate() { bind_to := "tcp://127.0.0.1:5555" err := zmq.SetIoThreads(1) if checkErr(err) { return } s_in, err := zmq.NewSocket(zmq.PULL) if checkErr(err) { return } err = s_in.SetConflate(true) if checkErr(err) { return } err = s_in.Bind(bind_to) if checkErr(err) { return } s_out, err := zmq.NewSocket(zmq.PUSH) if checkErr(err) { return } err = s_out.Connect(bind_to) if checkErr(err) { return } message_count := 20 for j := 0; j < message_count; j++ { _, err = s_out.Send(fmt.Sprint(j), 0) if checkErr(err) { return } } time.Sleep(time.Second) payload_recved, err := s_in.Recv(0) if checkErr(err) { return } i, err := strconv.Atoi(payload_recved) if checkErr(err) { return } if i != message_count-1 { checkErr(errors.New("payload_recved != message_count - 1")) return } err = s_in.Close() if checkErr(err) { return } err = s_out.Close() if checkErr(err) { return } fmt.Println("Done") // Output: // Done } func Example_test_connect_resolve() { sock, err := zmq.NewSocket(zmq.PUB) if checkErr(err) { return } err = sock.Connect("tcp://localhost:1234") checkErr(err) err = sock.Connect("tcp://localhost:invalid") fmt.Println(e(err, true)) err = sock.Connect("tcp://in val id:1234") fmt.Println(e(err, true)) err = sock.Connect("invalid://localhost:1234") fmt.Println(e(err, true)) err = sock.Close() checkErr(err) fmt.Println("Done") // Output: // error // error // error // Done } /* func Example_test_ctx_destroy() { fmt.Println("Done") // Output: // Done } */ func Example_test_ctx_options() { i, err := zmq.GetMaxSockets() fmt.Println(i == zmq.MaxSocketsDflt, err) i, err = zmq.GetIoThreads() fmt.Println(i == zmq.IoThreadsDflt, err) b, err := zmq.GetIpv6() fmt.Println(b, err) zmq.SetIpv6(true) b, err = zmq.GetIpv6() fmt.Println(b, err) router, _ := zmq.NewSocket(zmq.ROUTER) b, err = router.GetIpv6() fmt.Println(b, err) fmt.Println(router.Close()) zmq.SetIpv6(false) fmt.Println("Done") // Output: // true <nil> // true <nil> // false <nil> // true <nil> // true <nil> // <nil> // Done } func Example_test_disconnect_inproc() { publicationsReceived := 0 isSubscribed := false pubSocket, err := zmq.NewSocket(zmq.XPUB) if checkErr(err) { return } subSocket, err := zmq.NewSocket(zmq.SUB) if checkErr(err) { return } err = subSocket.SetSubscribe("foo") if checkErr(err) { return } err = pubSocket.Bind("inproc://someInProcDescriptor") if checkErr(err) { return } iteration := 0 poller := zmq.NewPoller() poller.Add(subSocket, zmq.POLLIN) // read publications poller.Add(pubSocket, zmq.POLLIN) // read subscriptions for { sockets, err := poller.Poll(100 * time.Millisecond) if checkErr(err) { break // Interrupted } for _, socket := range sockets { if socket.Socket == pubSocket { for { buffer, err := pubSocket.Recv(0) if checkErr(err) { return } fmt.Printf("pubSocket: %q\n", buffer) if buffer[0] == 0 { fmt.Println("pubSocket, isSubscribed == true:", isSubscribed == true) isSubscribed = false } else { fmt.Println("pubSocket, isSubscribed == false:", isSubscribed == false) isSubscribed = true } more, err := pubSocket.GetRcvmore() if checkErr(err) { return } if !more { break // Last message part } } break } } for _, socket := range sockets { if socket.Socket == subSocket { for { msg, err := subSocket.Recv(0) if checkErr(err) { return } fmt.Printf("subSocket: %q\n", msg) more, err := subSocket.GetRcvmore() if checkErr(err) { return } if !more { publicationsReceived++ break // Last message part } } break } } if iteration == 1 { err := subSocket.Connect("inproc://someInProcDescriptor") checkErr(err) } if iteration == 4 { err := subSocket.Disconnect("inproc://someInProcDescriptor") checkErr(err) } if iteration > 4 && len(sockets) == 0 { break } _, err = pubSocket.Send("foo", zmq.SNDMORE) checkErr(err) _, err = pubSocket.Send("this is foo!", 0) checkErr(err) iteration++ } fmt.Println("publicationsReceived == 3:", publicationsReceived == 3) fmt.Println("!isSubscribed:", !isSubscribed) err = pubSocket.Close() checkErr(err) err = subSocket.Close() checkErr(err) fmt.Println("Done") // Output: // pubSocket: "\x01foo" // pubSocket, isSubscribed == false: true // subSocket: "foo" // subSocket: "this is foo!" // subSocket: "foo" // subSocket: "this is foo!" // subSocket: "foo" // subSocket: "this is foo!" // pubSocket: "\x00foo" // pubSocket, isSubscribed == true: true // publicationsReceived == 3: true // !isSubscribed: true // Done } func Example_test_fork() { address := "tcp://127.0.0.1:6571" NUM_MESSAGES := 5 // Create and bind pull socket to receive messages pull, err := zmq.NewSocket(zmq.PULL) if checkErr(err) { return } err = pull.Bind(address) if checkErr(err) { return } done := make(chan bool) go func() { defer func() { done <- true }() // Create new socket, connect and send some messages push, err := zmq.NewSocket(zmq.PUSH) if checkErr(err) { return } defer func() { err := push.Close() checkErr(err) }() err = push.Connect(address) if checkErr(err) { return } for count := 0; count < NUM_MESSAGES; count++ { _, err = push.Send("Hello", 0) if checkErr(err) { return } } }() for count := 0; count < NUM_MESSAGES; count++ { msg, err := pull.Recv(0) fmt.Printf("%q %v\n", msg, err) } err = pull.Close() checkErr(err) <-done fmt.Println("Done") // Output: // "Hello" <nil> // "Hello" <nil> // "Hello" <nil> // "Hello" <nil> // "Hello" <nil> // Done } func Example_test_hwm() { MAX_SENDS := 10000 BIND_FIRST := 1 CONNECT_FIRST := 2 test_defaults := func() int { // Set up bind socket bind_socket, err := zmq.NewSocket(zmq.PULL) if checkErr(err) { return 0 } defer func() { err := bind_socket.Close() checkErr(err) }() err = bind_socket.Bind("inproc://a") if checkErr(err) { return 0 } // Set up connect socket connect_socket, err := zmq.NewSocket(zmq.PUSH) if checkErr(err) { return 0 } defer func() { err := connect_socket.Close() checkErr(err) }() err = connect_socket.Connect("inproc://a") if checkErr(err) { return 0 } // Send until we block send_count := 0 for send_count < MAX_SENDS { _, err := connect_socket.Send("", zmq.DONTWAIT) if err != nil { break } send_count++ } // Now receive all sent messages recv_count := 0 for { _, err := bind_socket.Recv(zmq.DONTWAIT) if err != nil { break } recv_count++ } fmt.Println("send_count == recv_count:", send_count == recv_count) return send_count } count_msg := func(send_hwm, recv_hwm, testType int) int { var bind_socket, connect_socket *zmq.Socket var err error if testType == BIND_FIRST { // Set up bind socket bind_socket, err = zmq.NewSocket(zmq.PULL) if checkErr(err) { return 0 } defer func() { err := bind_socket.Close() checkErr(err) }() err = bind_socket.SetRcvhwm(recv_hwm) if checkErr(err) { return 0 } err = bind_socket.Bind("inproc://a") if checkErr(err) { return 0 } // Set up connect socket connect_socket, err = zmq.NewSocket(zmq.PUSH) if checkErr(err) { return 0 } defer func() { err := connect_socket.Close() checkErr(err) }() err = connect_socket.SetSndhwm(send_hwm) if checkErr(err) { return 0 } err = connect_socket.Connect("inproc://a") if checkErr(err) { return 0 } } else { // Set up connect socket connect_socket, err = zmq.NewSocket(zmq.PUSH) if checkErr(err) { return 0 } defer func() { err := connect_socket.Close() checkErr(err) }() err = connect_socket.SetSndhwm(send_hwm) if checkErr(err) { return 0 } err = connect_socket.Connect("inproc://a") if checkErr(err) { return 0 } // Set up bind socket bind_socket, err = zmq.NewSocket(zmq.PULL) if checkErr(err) { return 0 } defer func() { err := bind_socket.Close() checkErr(err) }() err = bind_socket.SetRcvhwm(recv_hwm) if checkErr(err) { return 0 } err = bind_socket.Bind("inproc://a") if checkErr(err) { return 0 } } // Send until we block send_count := 0 for send_count < MAX_SENDS { _, err := connect_socket.Send("", zmq.DONTWAIT) if err != nil { break } send_count++ } // Now receive all sent messages recv_count := 0 for { _, err := bind_socket.Recv(zmq.DONTWAIT) if err != nil { break } recv_count++ } fmt.Println("send_count == recv_count:", send_count == recv_count) // Now it should be possible to send one more. _, err = connect_socket.Send("", 0) if checkErr(err) { return 0 } // Consume the remaining message. _, err = bind_socket.Recv(0) checkErr(err) return send_count } test_inproc_bind_first := func(send_hwm, recv_hwm int) int { return count_msg(send_hwm, recv_hwm, BIND_FIRST) } test_inproc_connect_first := func(send_hwm, recv_hwm int) int { return count_msg(send_hwm, recv_hwm, CONNECT_FIRST) } test_inproc_connect_and_close_first := func(send_hwm, recv_hwm int) int { // Set up connect socket connect_socket, err := zmq.NewSocket(zmq.PUSH) if checkErr(err) { return 0 } err = connect_socket.SetSndhwm(send_hwm) if checkErr(err) { connect_socket.Close() return 0 } err = connect_socket.Connect("inproc://a") if checkErr(err) { connect_socket.Close() return 0 } // Send until we block send_count := 0 for send_count < MAX_SENDS { _, err := connect_socket.Send("", zmq.DONTWAIT) if err != nil { break } send_count++ } // Close connect err = connect_socket.Close() if checkErr(err) { return 0 } // Set up bind socket bind_socket, err := zmq.NewSocket(zmq.PULL) if checkErr(err) { return 0 } defer func() { err := bind_socket.Close() checkErr(err) }() err = bind_socket.SetRcvhwm(recv_hwm) if checkErr(err) { return 0 } err = bind_socket.Bind("inproc://a") if checkErr(err) { return 0 } // Now receive all sent messages recv_count := 0 for { _, err := bind_socket.Recv(zmq.DONTWAIT) if err != nil { break } recv_count++ } fmt.Println("send_count == recv_count:", send_count == recv_count) return send_count } // Default values are 1000 on send and 1000 one receive, so 2000 total fmt.Println("Default values") count := test_defaults() fmt.Println("count:", count) time.Sleep(100 * time.Millisecond) // Infinite send and receive buffer fmt.Println("\nInfinite send and receive") count = test_inproc_bind_first(0, 0) fmt.Println("count:", count) time.Sleep(100 * time.Millisecond) count = test_inproc_connect_first(0, 0) fmt.Println("count:", count) time.Sleep(100 * time.Millisecond) // Infinite send buffer fmt.Println("\nInfinite send buffer") count = test_inproc_bind_first(1, 0) fmt.Println("count:", count) time.Sleep(100 * time.Millisecond) count = test_inproc_connect_first(1, 0) fmt.Println("count:", count) time.Sleep(100 * time.Millisecond) // Infinite receive buffer fmt.Println("\nInfinite receive buffer") count = test_inproc_bind_first(0, 1) fmt.Println("count:", count) time.Sleep(100 * time.Millisecond) count = test_inproc_connect_first(0, 1) fmt.Println("count:", count) time.Sleep(100 * time.Millisecond) // Send and recv buffers hwm 1, so total that can be queued is 2 fmt.Println("\nSend and recv buffers hwm 1") count = test_inproc_bind_first(1, 1) fmt.Println("count:", count) time.Sleep(100 * time.Millisecond) count = test_inproc_connect_first(1, 1) fmt.Println("count:", count) time.Sleep(100 * time.Millisecond) // Send hwm of 1, send before bind so total that can be queued is 1 fmt.Println("\nSend hwm of 1, send before bind") count = test_inproc_connect_and_close_first(1, 0) fmt.Println("count:", count) time.Sleep(100 * time.Millisecond) fmt.Println("\nDone") // Output: // Default values // send_count == recv_count: true // count: 2000 // // Infinite send and receive // send_count == recv_count: true // count: 10000 // send_count == recv_count: true // count: 10000 // // Infinite send buffer // send_count == recv_count: true // count: 10000 // send_count == recv_count: true // count: 10000 // // Infinite receive buffer // send_count == recv_count: true // count: 10000 // send_count == recv_count: true // count: 10000 // // Send and recv buffers hwm 1 // send_count == recv_count: true // count: 2 // send_count == recv_count: true // count: 2 // // Send hwm of 1, send before bind // send_count == recv_count: true // count: 1 // // Done } /* func Example_test_immediate() { fmt.Println("Done") // Output: // Done } func Example_test_inproc_connect() { fmt.Println("Done") // Output: // Done } func Example_test_invalid_rep() { fmt.Println("Done") // Output: // Done } func Example_test_iov() { fmt.Println("Done") // Output: // Done } func Example_test_issue_566() { fmt.Println("Done") // Output: // Done } func Example_test_last_endpoint() { fmt.Println("Done") // Output: // Done } func Example_test_linger() { fmt.Println("Done") // Output: // Done } func Example_test_monitor() { fmt.Println("Done") // Output: // Done } func Example_test_msg_flags() { fmt.Println("Done") // Output: // Done } func Example_test_pair_inproc() { fmt.Println("Done") // Output: // Done } */ func Example_test_pair_ipc() { sb, err := zmq.NewSocket(zmq.PAIR) if checkErr(err) { return } err = sb.Bind("ipc:///tmp/tester") if checkErr(err) { return } sc, err := zmq.NewSocket(zmq.PAIR) if checkErr(err) { return } err = sc.Connect("ipc:///tmp/tester") if checkErr(err) { return } bounce(sb, sc, false) err = sc.Close() if checkErr(err) { return } err = sb.Close() if checkErr(err) { return } fmt.Println("Done") // Output: // Done } func Example_test_pair_tcp() { sb, err := zmq.NewSocket(zmq.PAIR) if checkErr(err) { return } err = sb.Bind("tcp://127.0.0.1:9736") if checkErr(err) { return } sc, err := zmq.NewSocket(zmq.PAIR) if checkErr(err) { return } err = sc.Connect("tcp://127.0.0.1:9736") if checkErr(err) { return } bounce(sb, sc, false) err = sc.Close() if checkErr(err) { return } err = sb.Close() if checkErr(err) { return } fmt.Println("Done") // Output: // Done } /* func Example_test_probe_router() { fmt.Println("Done") // Output: // Done } func Example_test_req_correlate() { fmt.Println("Done") // Output: // Done } func Example_test_req_relaxed() { fmt.Println("Done") // Output: // Done } func Example_test_reqrep_device() { fmt.Println("Done") // Output: // Done } func Example_test_reqrep_inproc() { fmt.Println("Done") // Output: // Done } func Example_test_reqrep_ipc() { fmt.Println("Done") // Output: // Done } func Example_test_reqrep_tcp() { fmt.Println("Done") // Output: // Done } func Example_test_router_mandatory() { fmt.Println("Done") // Output: // Done } */ func Example_test_security_curve() { time.Sleep(100 * time.Millisecond) // Generate new keypairs for this test client_public, client_secret, err := zmq.NewCurveKeypair() if checkErr(err) { return } server_public, server_secret, err := zmq.NewCurveKeypair() if checkErr(err) { return } handler, err := zmq.NewSocket(zmq.REP) if checkErr(err) { return } err = handler.Bind("inproc://zeromq.zap.01") if checkErr(err) { return } doHandler := func(state zmq.State) error { msg, err := handler.RecvMessage(0) if err != nil { return err // Terminating } version := msg[0] sequence := msg[1] // domain := msg[2] // address := msg[3] identity := msg[4] mechanism := msg[5] client_key := msg[6] client_key_text := zmq.Z85encode(client_key) if version != "1.0" { return errors.New("version != 1.0") } if mechanism != "CURVE" { return errors.New("mechanism != CURVE") } if identity != "IDENT" { return errors.New("identity != IDENT") } if client_key_text == client_public { handler.SendMessage(version, sequence, "200", "OK", "anonymous", "") } else { handler.SendMessage(version, sequence, "400", "Invalid client public key", "", "") } return nil } doQuit := func(i interface{}) error { err := handler.Close() checkErr(err) fmt.Println("Handler closed") return errors.New("Quit") } quit := make(chan interface{}) reactor := zmq.NewReactor() reactor.AddSocket(handler, zmq.POLLIN, doHandler) reactor.AddChannel(quit, 0, doQuit) go func() { reactor.Run(100 * time.Millisecond) fmt.Println("Reactor finished") quit <- true }() defer func() { quit <- true <-quit close(quit) }() // Server socket will accept connections server, err := zmq.NewSocket(zmq.DEALER) if checkErr(err) { return } err = server.SetCurveServer(1) if checkErr(err) { return } err = server.SetCurveSecretkey(server_secret) if checkErr(err) { return } err = server.SetIdentity("IDENT") if checkErr(err) { return } server.Bind("tcp://127.0.0.1:9998") if checkErr(err) { return } err = server.SetRcvtimeo(time.Second) if checkErr(err) { return } // Check CURVE security with valid credentials client, err := zmq.NewSocket(zmq.DEALER) if checkErr(err) { return } err = client.SetCurveServerkey(server_public) if checkErr(err) { return } err = client.SetCurvePublickey(client_public) if checkErr(err) { return } err = client.SetCurveSecretkey(client_secret) if checkErr(err) { return } err = client.Connect("tcp://127.0.0.1:9998") if checkErr(err) { return } bounce(server, client, false) err = client.Close() if checkErr(err) { return } time.Sleep(100 * time.Millisecond) // Check CURVE security with a garbage server key // This will be caught by the curve_server class, not passed to ZAP garbage_key := "0000111122223333444455556666777788889999" client, err = zmq.NewSocket(zmq.DEALER) if checkErr(err) { return } err = client.SetCurveServerkey(garbage_key) if checkErr(err) { return } err = client.SetCurvePublickey(client_public) if checkErr(err) { return } err = client.SetCurveSecretkey(client_secret) if checkErr(err) { return } err = client.Connect("tcp://127.0.0.1:9998") if checkErr(err) { return } err = client.SetRcvtimeo(time.Second) if checkErr(err) { return } bounce(server, client, true) client.SetLinger(0) err = client.Close() if checkErr(err) { return } time.Sleep(100 * time.Millisecond) // Check CURVE security with a garbage client secret key // This will be caught by the curve_server class, not passed to ZAP client, err = zmq.NewSocket(zmq.DEALER) if checkErr(err) { return } err = client.SetCurveServerkey(server_public) if checkErr(err) { return } err = client.SetCurvePublickey(garbage_key) if checkErr(err) { return } err = client.SetCurveSecretkey(client_secret) if checkErr(err) { return } err = client.Connect("tcp://127.0.0.1:9998") if checkErr(err) { return } err = client.SetRcvtimeo(time.Second) if checkErr(err) { return } bounce(server, client, true) client.SetLinger(0) err = client.Close() if checkErr(err) { return } time.Sleep(100 * time.Millisecond) // Check CURVE security with a garbage client secret key // This will be caught by the curve_server class, not passed to ZAP client, err = zmq.NewSocket(zmq.DEALER) if checkErr(err) { return } err = client.SetCurveServerkey(server_public) if checkErr(err) { return } err = client.SetCurvePublickey(client_public) if checkErr(err) { return } err = client.SetCurveSecretkey(garbage_key) if checkErr(err) { return } err = client.Connect("tcp://127.0.0.1:9998") if checkErr(err) { return } err = client.SetRcvtimeo(time.Second) if checkErr(err) { return } bounce(server, client, true) client.SetLinger(0) err = client.Close() if checkErr(err) { return } time.Sleep(100 * time.Millisecond) // Check CURVE security with bogus client credentials // This must be caught by the ZAP handler bogus_public, bogus_secret, _ := zmq.NewCurveKeypair() client, err = zmq.NewSocket(zmq.DEALER) if checkErr(err) { return } err = client.SetCurveServerkey(server_public) if checkErr(err) { return } err = client.SetCurvePublickey(bogus_public) if checkErr(err) { return } err = client.SetCurveSecretkey(bogus_secret) if checkErr(err) { return } err = client.Connect("tcp://127.0.0.1:9998") if checkErr(err) { return } err = client.SetRcvtimeo(time.Second) if checkErr(err) { return } bounce(server, client, true) client.SetLinger(0) err = client.Close() if checkErr(err) { return } // Shutdown err = server.Close() checkErr(err) fmt.Println("Done") // Output: // 5 error // 5 error // 5 error // 5 error // Done // Handler closed // Reactor finished } func Example_test_security_null() { time.Sleep(100 * time.Millisecond) handler, err := zmq.NewSocket(zmq.REP) if checkErr(err) { return } err = handler.Bind("inproc://zeromq.zap.01") if checkErr(err) { return } doHandler := func(state zmq.State) error { msg, err := handler.RecvMessage(0) if err != nil { return err // Terminating } version := msg[0] sequence := msg[1] domain := msg[2] // address := msg[3] // identity := msg[4] mechanism := msg[5] if version != "1.0" { return errors.New("version != 1.0") } if mechanism != "NULL" { return errors.New("mechanism != NULL") } if domain == "TEST" { handler.SendMessage(version, sequence, "200", "OK", "anonymous", "") } else { handler.SendMessage(version, sequence, "400", "BAD DOMAIN", "", "") } return nil } doQuit := func(i interface{}) error { err := handler.Close() checkErr(err) fmt.Println("Handler closed") return errors.New("Quit") } quit := make(chan interface{}) reactor := zmq.NewReactor() reactor.AddSocket(handler, zmq.POLLIN, doHandler) reactor.AddChannel(quit, 0, doQuit) go func() { reactor.Run(100 * time.Millisecond) fmt.Println("Reactor finished") quit <- true }() defer func() { quit <- true <-quit close(quit) }() // We bounce between a binding server and a connecting client server, err := zmq.NewSocket(zmq.DEALER) if checkErr(err) { return } client, err := zmq.NewSocket(zmq.DEALER) if checkErr(err) { return } // We first test client/server with no ZAP domain // Libzmq does not call our ZAP handler, the connect must succeed err = server.Bind("tcp://127.0.0.1:9683") if checkErr(err) { return } err = client.Connect("tcp://127.0.0.1:9683") if checkErr(err) { return } bounce(server, client, false) server.Unbind("tcp://127.0.0.1:9683") client.Disconnect("tcp://127.0.0.1:9683") // Now define a ZAP domain for the server; this enables // authentication. We're using the wrong domain so this test // must fail. err = server.SetZapDomain("WRONG") if checkErr(err) { return } err = server.Bind("tcp://127.0.0.1:9687") if checkErr(err) { return } err = client.Connect("tcp://127.0.0.1:9687") if checkErr(err) { return } err = client.SetRcvtimeo(time.Second) if checkErr(err) { return } err = server.SetRcvtimeo(time.Second) if checkErr(err) { return } bounce(server, client, true) server.Unbind("tcp://127.0.0.1:9687") client.Disconnect("tcp://127.0.0.1:9687") // Now use the right domain, the test must pass err = server.SetZapDomain("TEST") if checkErr(err) { return } err = server.Bind("tcp://127.0.0.1:9688") if checkErr(err) { return } err = client.Connect("tcp://127.0.0.1:9688") if checkErr(err) { return } bounce(server, client, false) server.Unbind("tcp://127.0.0.1:9688") client.Disconnect("tcp://127.0.0.1:9688") err = client.Close() checkErr(err) err = server.Close() checkErr(err) fmt.Println("Done") // Output: // 5 error // Done // Handler closed // Reactor finished } func Example_test_security_plain() { time.Sleep(100 * time.Millisecond) handler, err := zmq.NewSocket(zmq.REP) if checkErr(err) { return } err = handler.Bind("inproc://zeromq.zap.01") if checkErr(err) { return } doHandler := func(state zmq.State) error { msg, err := handler.RecvMessage(0) if err != nil { return err // Terminating } version := msg[0] sequence := msg[1] // domain := msg[2] // address := msg[3] identity := msg[4] mechanism := msg[5] username := msg[6] password := msg[7] if version != "1.0" { return errors.New("version != 1.0") } if mechanism != "PLAIN" { return errors.New("mechanism != PLAIN") } if identity != "IDENT" { return errors.New("identity != IDENT") } if username == "admin" && password == "password" { handler.SendMessage(version, sequence, "200", "OK", "anonymous", "") } else { handler.SendMessage(version, sequence, "400", "Invalid username or password", "", "") } return nil } doQuit := func(i interface{}) error { err := handler.Close() checkErr(err) fmt.Println("Handler closed") return errors.New("Quit") } quit := make(chan interface{}) reactor := zmq.NewReactor() reactor.AddSocket(handler, zmq.POLLIN, doHandler) reactor.AddChannel(quit, 0, doQuit) go func() { reactor.Run(100 * time.Millisecond) fmt.Println("Reactor finished") quit <- true }() defer func() { quit <- true <-quit close(quit) }() // Server socket will accept connections server, err := zmq.NewSocket(zmq.DEALER) if checkErr(err) { return } err = server.SetIdentity("IDENT") if checkErr(err) { return } err = server.SetPlainServer(1) if checkErr(err) { return } err = server.Bind("tcp://127.0.0.1:9998") if checkErr(err) { return } // Check PLAIN security with correct username/password client, err := zmq.NewSocket(zmq.DEALER) if checkErr(err) { return } err = client.SetPlainUsername("admin") if checkErr(err) { return } err = client.SetPlainPassword("password") if checkErr(err) { return } err = client.Connect("tcp://127.0.0.1:9998") if checkErr(err) { return } bounce(server, client, false) err = client.Close() if checkErr(err) { return } // Check PLAIN security with badly configured client (as_server) // This will be caught by the plain_server class, not passed to ZAP client, err = zmq.NewSocket(zmq.DEALER) if checkErr(err) { return } client.SetPlainServer(1) if checkErr(err) { return } err = client.Connect("tcp://127.0.0.1:9998") if checkErr(err) { return } err = client.SetRcvtimeo(time.Second) if checkErr(err) { return } err = server.SetRcvtimeo(time.Second) if checkErr(err) { return } bounce(server, client, true) client.SetLinger(0) err = client.Close() if checkErr(err) { return } err = server.Close() checkErr(err) fmt.Println("Done") // Output: // 5 error // Done // Handler closed // Reactor finished } /* func Example_test_shutdown_stress() { fmt.Println("Done") // Output: // Done } func Example_test_spec_dealer() { fmt.Println("Done") // Output: // Done } func Example_test_spec_pushpull() { fmt.Println("Done") // Output: // Done } func Example_test_spec_rep() { fmt.Println("Done") // Output: // Done } func Example_test_spec_req() { fmt.Println("Done") // Output: // Done } func Example_test_spec_router() { fmt.Println("Done") // Output: // Done } func Example_test_stream() { fmt.Println("Done") // Output: // Done } func Example_test_sub_forward() { fmt.Println("Done") // Output: // Done } func Example_test_system() { fmt.Println("Done") // Output: // Done } func Example_test_term_endpoint() { fmt.Println("Done") // Output: // Done } func Example_test_timeo() { fmt.Println("Done") // Output: // Done } */ func bounce(server, client *zmq.Socket, willfail bool) { content := "12345678ABCDEFGH12345678abcdefgh" // Send message from client to server rc, err := client.Send(content, zmq.SNDMORE|zmq.DONTWAIT) if checkErr0(err, 1) { return } if rc != 32 { checkErr0(errors.New("rc != 32"), 2) } rc, err = client.Send(content, zmq.DONTWAIT) if checkErr0(err, 3) { return } if rc != 32 { checkErr0(errors.New("rc != 32"), 4) } // Receive message at server side msg, err := server.Recv(0) if checkErr0(e(err, willfail), 5) { return } // Check that message is still the same if msg != content { checkErr0(errors.New(fmt.Sprintf("%q != %q", msg, content)), 6) } rcvmore, err := server.GetRcvmore() if checkErr0(err, 7) { return } if !rcvmore { checkErr0(errors.New(fmt.Sprint("rcvmore ==", rcvmore)), 8) return } // Receive message at server side msg, err = server.Recv(0) if checkErr0(err, 9) { return } // Check that message is still the same if msg != content { checkErr0(errors.New(fmt.Sprintf("%q != %q", msg, content)), 10) } rcvmore, err = server.GetRcvmore() if checkErr0(err, 11) { return } if rcvmore { checkErr0(errors.New(fmt.Sprint("rcvmore == ", rcvmore)), 12) return } // The same, from server back to client // Send message from server to client rc, err = server.Send(content, zmq.SNDMORE) if checkErr0(err, 13) { return } if rc != 32 { checkErr0(errors.New("rc != 32"), 14) } rc, err = server.Send(content, 0) if checkErr0(err, 15) { return } if rc != 32 { checkErr0(errors.New("rc != 32"), 16) } // Receive message at client side msg, err = client.Recv(0) if checkErr0(err, 17) { return } // Check that message is still the same if msg != content { checkErr0(errors.New(fmt.Sprintf("%q != %q", msg, content)), 18) } rcvmore, err = client.GetRcvmore() if checkErr0(err, 19) { return } if !rcvmore { checkErr0(errors.New(fmt.Sprint("rcvmore ==", rcvmore)), 20) return } // Receive message at client side msg, err = client.Recv(0) if checkErr0(err, 21) { return } // Check that message is still the same if msg != content { checkErr0(errors.New(fmt.Sprintf("%q != %q", msg, content)), 22) } rcvmore, err = client.GetRcvmore() if checkErr0(err, 23) { return } if rcvmore { checkErr0(errors.New(fmt.Sprint("rcvmore == ", rcvmore)), 24) return } } func checkErr0(err error, num int) bool { if err != nil { fmt.Println(num, err) return true } return false } func checkErr(err error) bool { if err != nil { _, filename, lineno, ok := runtime.Caller(1) if ok { fmt.Printf("%v:%v: %v\n", filename, lineno, err) } else { fmt.Println(err) } return true } return false } func e(err error, willfail bool) error { if err == nil || willfail == false { return err } return errerr }
package main import "fmt" //定义结构体 Emp type Emp struct { name string age int8 sex byte } /* 结构体的一些语法糖 */ func main() { //使用new()内置函数实例化struct emp1 := new(Emp) fmt.Printf("emp1: %T , %v , %p \n", emp1, emp1, emp1) (*emp1).name = "David" (*emp1).age = 30 (*emp1).sex = 1 //语法糖写法 emp1.name = "David2" emp1.age = 31 emp1.sex = 1 fmt.Println(emp1) fmt.Println("-----------------") SyntacticSugar() } func SyntacticSugar() { // 数组中的语法糖 arr := [4]int{10, 20, 30, 40} arr2 := &arr fmt.Println((*arr2)[len(arr)-1]) fmt.Println(arr2[0]) // 切片中的语法糖? arr3 := []int{100, 200, 300, 400} arr4 := &arr3 fmt.Println((*arr4)[len(arr)-1]) //fmt.Println(arr4[0]) }
package kstcmd import ( "../kstclient" "../kstserver" "fmt" "github.com/spf13/cobra" ) var RootCmd = &cobra.Command{ Use: "kstcmd", Short:"simple [K:V] storage", Long:"simple [K:V] storage", Run: func(cmd *cobra.Command, args []string) { cmd.Usage() //fmt.Printf("RootCmd exec\n"); }, } //server命令上下文 type servercontext struct{ server *cobra.Command flag_port string } //bucket命令上下文 type bucketcontext struct{ bukcket *cobra.Command create *cobra.Command delete *cobra.Command flag_name string flag_addr string } //key命令上下文 type keycontext struct{ key *cobra.Command set *cobra.Command delete *cobra.Command get *cobra.Command test_set *cobra.Command test_get *cobra.Command flag_key string flag_value string flag_bucket string flag_addr string flag_prefix bool flag_threads int flag_count int } type restorecontext struct{ restore *cobra.Command flag_addr string flag_file_name string } type backupcontext struct{ backup *cobra.Command flag_addr string flag_file_name string } //命令上下文全局变量定义 var serverctx = servercontext{} var buckctx = bucketcontext{} var keyctx = keycontext{} var restorectx = restorecontext{} var backupctx = backupcontext{} const( FLAG_ADDR = "addr" FLAG_ADDR_DEFAULT = "localhost:12345" FLAG_ADDR_DETAIL = "set a server port.(default)--port 123456" FLAG_NAME = "name" FLAG_NAME_DEFAULT = "" FLAG_NAME_DETAIL = "" FLAG_BUCKET = "bucket" FLAG_BUCKET_DEFALUT = "" FLAG_BUCKET_DETAIL = "" FLAG_PORT = "port" FLAG_PORT_DEFAULT = "12345" FLAG_PORT_DETAIL = "" FLAG_KEY = "key" FLAG_KEY_DEFAULT = "" FLAG_KEY_DETAIL = "" FLAG_VALUE = "value" FLAG_VALUE_DEFAULT = "" FLAG_VALUE_DETAIL = "" FLAG_PREFIX = "prefix" FLAG_PREFIX_DEFAULT = false FLAG_PREFIX_DETAIL = "" FLAG_FILE_NAME = "filename" FLAG_FILE_NAME_DEFAULT ="" FLAG_FILE_NAME_DETAIL = "restore/backup file name" ) func init(){ //serverctx初始化 serverctx.server = &cobra.Command{ Use:"server", Short: "start a server", Long: "start a server", Run: func(cmd *cobra.Command, args []string) { kstserver.InitServer(serverctx.flag_port) }, } //bucketctx初始化 buckctx.bukcket = &cobra.Command{ Use:"bucket", Short: "create/delete a bucket", Long: "create/delete a bucket", Run: func(cmd *cobra.Command, args []string) { cmd.Usage() }, } buckctx.create = &cobra.Command{ Use:"create", Short: "create a bucket", Long: "create a bucket", Run: func(cmd *cobra.Command, args []string) { //fmt.Println("create exec") kstclient.InitClient(buckctx.flag_addr) kstclient.CreateBucket(buckctx.flag_name) }, } buckctx.delete = &cobra.Command{ Use:"delete", Short: "delete a bucket", Long: "delete a bucket", Run: func(cmd *cobra.Command, args []string) { //fmt.Println("delete exec") kstclient.InitClient(buckctx.flag_addr) kstclient.DelBucket(buckctx.flag_name) }, } //keyctx初始化 keyctx.key = &cobra.Command{ Use: "key", Short: "operation on key", Long: "operation on key", Run: func(cmd *cobra.Command, args []string) { //fmt.Println("key exec") cmd.Usage() }, } keyctx.set = &cobra.Command{ Use: "set", Short: "set a key", Long: "set a key", Run: func(cmd *cobra.Command, args []string) { //fmt.Println("set exec") kstclient.InitClient(keyctx.flag_addr) kstclient.InsertKey(keyctx.flag_bucket, keyctx.flag_key, keyctx.flag_value) }, } keyctx.test_set = &cobra.Command{ Use: "test", Short: "test set", Long: "test set", Run: func(cmd *cobra.Command, args []string) { fmt.Println("set test") kstclient.InitClient(keyctx.flag_addr) kstclient.TestSet(keyctx.flag_threads, keyctx.flag_count) }, } keyctx.test_get = &cobra.Command{ Use: "test", Short: "test get", Long: "test get", Run: func(cmd *cobra.Command, args []string) { fmt.Println("get test") kstclient.InitClient(keyctx.flag_addr) kstclient.TestGet(keyctx.flag_threads, keyctx.flag_count) }, } keyctx.delete = &cobra.Command{ Use: "delete", Short: "delete a key", Long: "delete a key", Run: func(cmd *cobra.Command, args []string) { //fmt.Println("delete exec") kstclient.InitClient(keyctx.flag_addr) kstclient.DelKey(keyctx.flag_bucket, keyctx.flag_key) }, } keyctx.get = &cobra.Command{ Use: "get", Short: "get a key value", Long: "get a key value", Run: func(cmd *cobra.Command, args []string) { //fmt.Println("get exec") kstclient.InitClient(keyctx.flag_addr) if keyctx.flag_prefix { kstclient.GetKeyWithPrefix(keyctx.flag_bucket, keyctx.flag_key) }else{ kstclient.GetKey(keyctx.flag_bucket, keyctx.flag_key) } }, } //restorectx初始化 restorectx.restore = &cobra.Command{ Use: "restore", Short: "restore a specific boltdb", Long: "restore a specific boltdb", Run: func(cmd *cobra.Command, args []string) { fmt.Println("restore exec") kstclient.InitClient(restorectx.flag_addr) kstclient.UploadFile(restorectx.flag_file_name) }, } //restorectx初始化 backupctx.backup = &cobra.Command{ Use: "backup", Short: "backup boltdb to a specific file", Long: "backup boltdb to a specific file", Run: func(cmd *cobra.Command, args []string) { fmt.Println("backup exec") kstclient.InitClient(backupctx.flag_addr) kstclient.Backup(backupctx.flag_file_name) }, } serverctx.server.Flags().StringVar(&serverctx.flag_port, FLAG_PORT, FLAG_PORT_DEFAULT, FLAG_PORT_DETAIL) RootCmd.AddCommand(serverctx.server) //添加bucket命令 RootCmd.AddCommand(buckctx.bukcket) //添加create/delete buckctx.create.Flags().StringVar(&buckctx.flag_name, FLAG_NAME, FLAG_NAME_DEFAULT, FLAG_NAME_DETAIL) buckctx.create.Flags().StringVar(&buckctx.flag_addr, FLAG_ADDR, FLAG_ADDR_DEFAULT, FLAG_ADDR_DETAIL) buckctx.create.MarkFlagRequired(FLAG_NAME) buckctx.bukcket.AddCommand(buckctx.create) buckctx.delete.Flags().StringVar(&buckctx.flag_name, FLAG_NAME, FLAG_NAME_DEFAULT, FLAG_NAME_DETAIL) buckctx.delete.Flags().StringVar(&buckctx.flag_addr, FLAG_ADDR, FLAG_ADDR_DEFAULT, FLAG_ADDR_DETAIL) buckctx.delete.MarkFlagRequired(FLAG_NAME) buckctx.bukcket.AddCommand(buckctx.delete) //添加key RootCmd.AddCommand(keyctx.key) //添加set keyctx.set.Flags().StringVar(&keyctx.flag_key, FLAG_KEY, FLAG_KEY_DEFAULT, FLAG_KEY_DETAIL) keyctx.set.Flags().StringVar(&keyctx.flag_value, FLAG_VALUE, FLAG_VALUE_DEFAULT, FLAG_VALUE_DETAIL) keyctx.set.Flags().StringVar(&keyctx.flag_bucket, FLAG_BUCKET, FLAG_BUCKET_DEFALUT, FLAG_BUCKET_DETAIL) keyctx.set.Flags().StringVar(&keyctx.flag_addr, FLAG_ADDR, FLAG_ADDR_DEFAULT, FLAG_ADDR_DETAIL) keyctx.set.MarkFlagRequired(FLAG_BUCKET) keyctx.set.MarkFlagRequired(FLAG_KEY) keyctx.key.AddCommand(keyctx.set) keyctx.test_set.Flags().StringVar(&keyctx.flag_addr, FLAG_ADDR, FLAG_ADDR_DEFAULT, FLAG_ADDR_DETAIL) keyctx.test_set.Flags().IntVar(&keyctx.flag_threads, "threads", 0, "") keyctx.test_set.Flags().IntVar(&keyctx.flag_count, "count", 0, "") keyctx.test_set.MarkFlagRequired("threads") keyctx.test_set.MarkFlagRequired("count") keyctx.set.AddCommand(keyctx.test_set) //添加get keyctx.get.Flags().StringVar(&keyctx.flag_key, FLAG_KEY, FLAG_KEY_DEFAULT, FLAG_KEY_DETAIL) keyctx.get.Flags().StringVar(&keyctx.flag_bucket, FLAG_BUCKET, FLAG_BUCKET_DEFALUT, FLAG_BUCKET_DETAIL) keyctx.get.Flags().StringVar(&keyctx.flag_addr, FLAG_ADDR, FLAG_ADDR_DEFAULT, FLAG_ADDR_DETAIL) keyctx.get.Flags().BoolVar(&keyctx.flag_prefix, FLAG_PREFIX, FLAG_PREFIX_DEFAULT, FLAG_PREFIX_DETAIL) keyctx.get.MarkFlagRequired(FLAG_BUCKET) keyctx.get.MarkFlagRequired(FLAG_KEY) keyctx.key.AddCommand(keyctx.get) keyctx.test_get.Flags().StringVar(&keyctx.flag_addr, FLAG_ADDR, FLAG_ADDR_DEFAULT, FLAG_ADDR_DETAIL) keyctx.test_get.Flags().IntVar(&keyctx.flag_threads, "threads", 0, "") keyctx.test_get.Flags().IntVar(&keyctx.flag_count, "count", 0, "") keyctx.test_get.MarkFlagRequired("threads") keyctx.test_get.MarkFlagRequired("count") keyctx.get.AddCommand(keyctx.test_get) //添加delete keyctx.delete.Flags().StringVar(&keyctx.flag_key, FLAG_KEY, FLAG_KEY_DEFAULT, FLAG_KEY_DETAIL) keyctx.delete.Flags().StringVar(&keyctx.flag_bucket, FLAG_BUCKET, FLAG_BUCKET_DEFALUT, FLAG_BUCKET_DETAIL) keyctx.delete.Flags().StringVar(&keyctx.flag_addr, FLAG_ADDR, FLAG_ADDR_DEFAULT, FLAG_ADDR_DETAIL) keyctx.delete.MarkFlagRequired(FLAG_BUCKET) keyctx.delete.MarkFlagRequired(FLAG_KEY) keyctx.key.AddCommand(keyctx.delete) //添加restore restorectx.restore.Flags().StringVar(&restorectx.flag_addr, FLAG_ADDR, FLAG_ADDR_DEFAULT, FLAG_ADDR_DETAIL) restorectx.restore.Flags().StringVar(&restorectx.flag_file_name, FLAG_FILE_NAME, FLAG_FILE_NAME_DEFAULT, FLAG_FILE_NAME_DETAIL) restorectx.restore.MarkFlagRequired(FLAG_FILE_NAME) RootCmd.AddCommand(restorectx.restore) backupctx.backup.Flags().StringVar(&backupctx.flag_addr, FLAG_ADDR, FLAG_ADDR_DEFAULT, FLAG_ADDR_DETAIL) backupctx.backup.Flags().StringVar(&backupctx.flag_file_name, FLAG_FILE_NAME, FLAG_FILE_NAME_DEFAULT, FLAG_FILE_NAME_DETAIL) backupctx.backup.MarkFlagRequired(FLAG_FILE_NAME) RootCmd.AddCommand(backupctx.backup) }
package api import ( "encoding/json" "errors" "math" "project/app/admin/models" "project/app/admin/models/dto" "project/app/admin/service" "project/common/cache" "project/common/global" "github.com/gin-gonic/gin" ) const ( CtxUserIdAndName = "user" CtxUserIDKey = "user_id" CtxUserInfoKey = "info" CtxUserOnline = "user_online" ) type UserMessage struct { UserId int Username string } type UserInfo struct { Jobs *[]models.SysJob Roles *[]models.SysRole MenuPermission *[]string Dept *models.SysDept DataScopes *[]int } var ErrorUserNotLogin = errors.New("用户未登录") // GetCurrentUserId 获取当前登录的用户ID func GetCurrentUserId(c *gin.Context) (userId int, err error) { uid, ok := c.Get(CtxUserIDKey) if !ok { err = ErrorUserNotLogin return } userId, ok = uid.(int) if !ok { err = ErrorUserNotLogin return } return } // GetUserMessage 获取当前登录的用户ID和用户名 func GetUserMessage(c *gin.Context) (*UserMessage, error) { res, ok := c.Get(CtxUserIdAndName) if !ok { err := ErrorUserNotLogin return nil, err } userMessage := res.(*UserMessage) return userMessage, nil } // 获取用户完整信息 func GetUserData(c *gin.Context) (user *UserInfo, err error) { userId, err := GetCurrentUserId(c) if err != nil { return } keys := new([]string) *keys = append(*keys, cache.KeyUserJob, cache.KeyUserRole, cache.KeyUserMenu, cache.KeyUserDept, cache.KeyUserDataScope) cacheMap := cache.GetUserCache(keys, userId) cacheJob, jobErr := cacheMap[cache.KeyUserJob].Result() cacheRole, rolesErr := cacheMap[cache.KeyUserRole].Result() cacheMenu, menuErr := cacheMap[cache.KeyUserMenu].Result() cacheDept, deptErr := cacheMap[cache.KeyUserDept].Result() cacheDataScopes, dataScopesErr := cacheMap[cache.KeyUserDataScope].Result() jobs := new([]models.SysJob) if err = service.GetUserJobData(cacheJob, jobErr, jobs, userId); err != nil { return nil, err } roles := new([]models.SysRole) if err = service.GetUserRoleData(cacheRole, rolesErr, roles, userId); err != nil { return nil, err } menuPermission := new([]string) if err = service.GetUserMenuData(cacheMenu, menuErr, userId, menuPermission, roles); err != nil { return nil, err } dept := new(models.SysDept) if err = service.GetUserDeptData(cacheDept, deptErr, dept, userId); err != nil { return nil, err } dataScopes := new([]int) if err = service.GetUserDataScopes(cacheDataScopes, dataScopesErr, dataScopes, userId, dept.ID, roles); err != nil { return nil, err } user = new(UserInfo) user.Jobs = jobs user.Roles = roles user.MenuPermission = menuPermission user.Dept = dept user.DataScopes = dataScopes return } // GetUserOnline 获取用户线上数据 func GetUserOnline(c *gin.Context) (userOnline *models.OnlineUser, err error) { res, ok := c.Get(CtxUserOnline) if !ok { err = ErrorUserNotLogin return } userOnline = new(models.OnlineUser) err = json.Unmarshal([]byte(res.(string)), userOnline) return } func CheckDataScope(dataScope []int, deptID int) bool { if len(dataScope) == 0 { return true } for _, v := range dataScope { if v == deptID { return true } } return false } func CheckUpdateLevel(operatorId int, operatorRoles []models.SysRole, byOperator *dto.UpdateUserDto) bool { //验证是否为自己 //查找操作者最高等级 operatorMaxLevel := math.MaxInt64 for _, role := range operatorRoles { if role.Level < operatorMaxLevel { operatorMaxLevel = role.Level } } if operatorId != byOperator.ID { //根据id查找用户角色最高等级 byOperateRoles, err := models.SelectUserRole(byOperator.ID) if err != nil { return false } byOperatorMaxLevel := math.MaxInt64 for _, role := range byOperateRoles { if role.Level < byOperatorMaxLevel { byOperatorMaxLevel = role.Level } } return operatorMaxLevel < byOperatorMaxLevel } //验证是否有权利修改目标用户 changeToRoles := make([]models.SysRole, 0) global.Eloquent.Table("sys_role").Where("id in (?) AND is_delete = ?", byOperator.Roles, []byte{0}).Find(changeToRoles) changeToRolesMaxLevel := math.MaxInt64 for _, role := range changeToRoles { if role.Level < changeToRolesMaxLevel { changeToRolesMaxLevel = role.Level } } return changeToRolesMaxLevel >= operatorMaxLevel } func CheckInsertLevel(operatorRoles []models.SysRole, byOperatorRoleId []int) bool { //查找操作者最高等级 operatorMaxLevel := math.MaxInt64 for _, role := range operatorRoles { if role.Level < operatorMaxLevel { operatorMaxLevel = role.Level } } byOperatorRoles := make([]models.SysRole, 0) global.Eloquent.Table("sys_role").Where("id in (?) AND is_delete = ?", byOperatorRoleId, []byte{0}).Find(byOperatorRoles) byOperatorMaxLevel := math.MaxInt64 for _, role := range byOperatorRoles { if role.Level < byOperatorMaxLevel { byOperatorMaxLevel = role.Level } } return operatorMaxLevel < byOperatorMaxLevel }
package builder import ( "fmt" "reflect" "sort" "strings" "testing" "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/assert" ) func getDescStruct(opts MetricOpts, labelKeyValues map[string]string) string { lpStrings := make([]string, 0, len(labelKeyValues)) for key, value := range labelKeyValues { lpStrings = append(lpStrings, fmt.Sprintf("%s=%q", key, value)) } sort.Strings(lpStrings) return fmt.Sprintf("Desc{fqName: %q, help: %q, constLabels: {%s}, variableLabels: %v}", opts.Name, opts.Desc, strings.Join(lpStrings, ","), []string{}) } func getCollectorDescription(collector prometheus.Collector) string { switch reflect.TypeOf(collector).Elem().Name() { case "histogram": return collector.(prometheus.Histogram).Desc().String() case "counter": return collector.(prometheus.Counter).Desc().String() default: return "" } } // TestNewMetricBuilder tests the Metric Builder initializer. func TestMetricBuilder(t *testing.T) { cases := []struct { name string expectedCollectorType string opts MetricOpts labelKeyValues map[string]string value float64 expectedErrorMessage string }{ { name: "Test histogram creation", expectedCollectorType: "histogram", opts: MetricOpts{ Labels: []string{"test1", "test2"}, Desc: "test histogram metrics", Name: "test_histogram", Buckets: []float64{10, 20, 30}, MetricType: Histogram, }, labelKeyValues: map[string]string{"test1": "test1", "test2": "test2"}, value: 0, expectedErrorMessage: "", }, { name: "Test invalid labels", expectedCollectorType: "histogram", opts: MetricOpts{ Labels: nil, Desc: "test metric", Name: "test", MetricType: "Histogram", }, labelKeyValues: map[string]string{"test1": "test1", "test2": "test2"}, value: 0, expectedErrorMessage: `labels cannot be empty`, }, { name: "Test invalid name", expectedCollectorType: "histogram", opts: MetricOpts{ Labels: []string{"test1", "test2"}, Desc: "test metric", Name: "", MetricType: "Histogram", }, labelKeyValues: map[string]string{"test1": "test1", "test2": "test2"}, value: 0, expectedErrorMessage: `name cannot be empty`, }, { name: "Test invalid metric type", expectedCollectorType: "histogram", opts: MetricOpts{ Labels: []string{"test1", "test2"}, Desc: "test metric", Name: "test", MetricType: "", }, labelKeyValues: map[string]string{"test1": "test1", "test2": "test2"}, value: 0, expectedErrorMessage: `metricType cannot be empty`, }, } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { _, err := NewMetricBuilder(tc.opts, tc.value, tc.labelKeyValues) if tc.expectedErrorMessage == "" { assert.NoError(t, err, "expected successful builder creation") } else { assert.Error(t, err, "expected builder creation failure but builder was created") assert.EqualError(t, err, tc.expectedErrorMessage) } }) } } // TestMetricBuilderCollector tests the PromCollector function. func TestMetricBuilderCollector(t *testing.T) { cases := []struct { name string expectedCollectorType string opts MetricOpts labelKeyValues map[string]string value float64 expectedErrorMessage string }{ { name: "Test histogram creation", expectedCollectorType: "histogram", opts: MetricOpts{ Labels: []string{"test1", "test2"}, Desc: "test histogram metrics", Name: "test_histogram", Buckets: []float64{10, 20, 30}, MetricType: Histogram, }, labelKeyValues: map[string]string{"test1": "test1", "test2": "test2"}, value: 0, expectedErrorMessage: "", }, { name: "Test counter creation", expectedCollectorType: "counter", opts: MetricOpts{ Labels: []string{"test1", "test2"}, Desc: "test modification metric", Name: "test_modification", MetricType: Counter, }, labelKeyValues: map[string]string{"test1": "test1", "test2": "test2"}, expectedErrorMessage: "", }, { name: "Test empty label values", expectedCollectorType: "counter", opts: MetricOpts{ Labels: []string{"test1", "test2"}, Desc: "test modification metric", Name: "test_modification", MetricType: Counter, }, labelKeyValues: nil, value: 0, expectedErrorMessage: "", }, { name: "Test invalid metricType", expectedCollectorType: "Linear", opts: MetricOpts{ Labels: []string{"test1", "test2"}, Desc: "test metric", Name: "test", MetricType: "Linear", }, labelKeyValues: map[string]string{"test1": "test1", "test2": "test2"}, value: 0, expectedErrorMessage: `invalid metric builder type "Linear". cannot create collector`, }, } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { metricBuilder, err := NewMetricBuilder(tc.opts, tc.value, tc.labelKeyValues) if !assert.NoError(t, err, "error constructing new metric builder") { return } collector, err := metricBuilder.PromCollector() if tc.expectedErrorMessage == "" { assert.NoError(t, err, "expected successful collector creation") assert.EqualValues(t, tc.expectedCollectorType, reflect.TypeOf(collector).Elem().Name()) expectedString := getDescStruct(tc.opts, tc.labelKeyValues) assert.EqualValues(t, expectedString, getCollectorDescription(collector)) } else { assert.Error(t, err, "expected collector creation failure but collector was created") assert.EqualError(t, err, tc.expectedErrorMessage) } }) } } // TestNewMetricBuilder tests the Metric Builder initializer. func TestNewMetricBuilder(t *testing.T) { opts := MetricOpts{ Labels: []string{"test1", "test2", "test3"}, Desc: "test metric", Name: "test", Buckets: []float64{10, 20, 30}, MetricType: Histogram, } labelKeyValues := map[string]string{"test1": "test1", "test2": "test2"} metricBuilder, err := NewMetricBuilder(opts, 10, labelKeyValues) if err != nil { assert.Failf(t, err.Error(), "error creating metric builder") } else { assert.EqualValues(t, metricBuilder.value, 10) assert.EqualValues(t, metricBuilder.labels, opts.Labels) assert.EqualValues(t, metricBuilder.labelKeyValues, labelKeyValues) assert.EqualValues(t, metricBuilder.desc, opts.Desc) assert.EqualValues(t, metricBuilder.name, opts.Name) assert.EqualValues(t, metricBuilder.buckets, opts.Buckets) assert.EqualValues(t, metricBuilder.metricType, Histogram) } metricBuilder.SetValue(10) assert.EqualValues(t, 10, metricBuilder.value) err = metricBuilder.AddLabelValue("test", "metric labels") assert.Error(t, err, "expected error adding label") _, found := metricBuilder.labelKeyValues["test"] assert.False(t, found) err = metricBuilder.AddLabelValue("test3", "metric labels") if err != nil { assert.Failf(t, err.Error(), "error adding label value") } _, found = metricBuilder.labelKeyValues["test3"] assert.True(t, found) }
/* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package topic import ( "context" "fmt" "reflect" "strings" "time" ibmcloud "github.com/ibm/cloud-operators/pkg/apis/ibmcloud/v1alpha1" rcontext "github.com/ibm/cloud-operators/pkg/context" ibmcloudv1alpha1 "github.com/ibm/event-streams-topic/pkg/apis/ibmcloud/v1alpha1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/manager" "sigs.k8s.io/controller-runtime/pkg/reconcile" logf "sigs.k8s.io/controller-runtime/pkg/runtime/log" "sigs.k8s.io/controller-runtime/pkg/source" ) var logt = logf.Log.WithName("topic") const topicFinalizer = "topic.ibmcloud.ibm.com" // ContainsFinalizer checks if the instance contains service finalizer func ContainsFinalizer(instance *ibmcloudv1alpha1.Topic) bool { for _, finalizer := range instance.ObjectMeta.Finalizers { if strings.Contains(finalizer, topicFinalizer) { return true } } return false } // DeleteFinalizer delete service finalizer func DeleteFinalizer(instance *ibmcloudv1alpha1.Topic) []string { var result []string for _, finalizer := range instance.ObjectMeta.Finalizers { if finalizer == topicFinalizer { continue } result = append(result, finalizer) } return result } // Add creates a new Topic Controller and adds it to the Manager with default RBAC. The Manager will set fields on the Controller // and Start it when the Manager is Started. // USER ACTION REQUIRED: update cmd/manager/main.go to call this ibmcloud.Add(mgr) to install this Controller func Add(mgr manager.Manager) error { return add(mgr, newReconciler(mgr)) } // newReconciler returns a new reconcile.Reconciler func newReconciler(mgr manager.Manager) reconcile.Reconciler { return &ReconcileTopic{Client: mgr.GetClient(), scheme: mgr.GetScheme()} } // add adds a new Controller to mgr with r as the reconcile.Reconciler func add(mgr manager.Manager, r reconcile.Reconciler) error { // Create a new controller c, err := controller.New("topic-controller", mgr, controller.Options{Reconciler: r, MaxConcurrentReconciles: 33}) if err != nil { return err } // Watch for changes to Topic err = c.Watch(&source.Kind{Type: &ibmcloudv1alpha1.Topic{}}, &handler.EnqueueRequestForObject{}) if err != nil { return err } // TODO(user): Modify this to be the types you create // Uncomment watch a Deployment created by Binding - change this for objects you create err = c.Watch(&source.Kind{Type: &corev1.ConfigMap{}}, &handler.EnqueueRequestForOwner{ IsController: true, OwnerType: &ibmcloud.Binding{}, }) if err != nil { return err } return nil } var _ reconcile.Reconciler = &ReconcileTopic{} // ReconcileTopic reconciles a Topic object type ReconcileTopic struct { client.Client scheme *runtime.Scheme } // Reconcile reads that state of the cluster for a Topic object and makes changes based on the state read // and what is in the Topic.Spec // Automatically generate RBAC rules to allow the Controller to read and write Deployments // +kubebuilder:rbac:groups=ibmcloud.ibm.com,resources=topics,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=ibmcloud.ibm.com,resources=topics/status,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=ibmcloud.ibm.com,resources=topics/finalizers,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=,resources=configmaps,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=,resources=secrets,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=ibmcloud.ibm.com,resources=bindings,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=ibmcloud.ibm.com,resources=bindings/finalizers,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=ibmcloud.ibm.com,resources=bindings/status,verbs=get;list;watch;create;update;patch;delete func (r *ReconcileTopic) Reconcile(request reconcile.Request) (reconcile.Result, error) { ctx := rcontext.New(r.Client, request) // Fetch the Topic instance instance := &ibmcloudv1alpha1.Topic{} err := r.Get(context.Background(), request.NamespacedName, instance) if err != nil { if errors.IsNotFound(err) { // Object not found, return. Created objects are automatically garbage collected. // For additional cleanup logic use finalizers. return reconcile.Result{}, nil } // Error reading the object - requeue the request. return reconcile.Result{}, err } // Set the Status field for the first time if reflect.DeepEqual(instance.Status, ibmcloudv1alpha1.TopicStatus{}) { instance.Status.State = "Pending" instance.Status.Message = "Processing Resource" if err := r.Status().Update(context.Background(), instance); err != nil { return reconcile.Result{}, nil } } // Check that the spec is well-formed if !isWellFormed(*instance) { if !instance.ObjectMeta.DeletionTimestamp.IsZero() { // In this case it is enough to simply remove the finalizer: instance.ObjectMeta.Finalizers = DeleteFinalizer(instance) if err := r.Update(context.Background(), instance); err != nil { logt.Info("Error removing finalizers", "in deletion", err.Error()) // No further action required, object was modified, another reconcile will finish the job. } return reconcile.Result{}, nil } return r.updateStatusError(instance, "Failed", fmt.Errorf("The spec is not well-formed").Error()) } kafkaAdminURL, apiKey, ret, err := getKafkaAdminInfo(r, ctx, instance) if err != nil { if !instance.ObjectMeta.DeletionTimestamp.IsZero() { // In this case it is enough to simply remove the finalizer: instance.ObjectMeta.Finalizers = DeleteFinalizer(instance) if err := r.Update(context.Background(), instance); err != nil { logt.Info("Error removing finalizers", "in deletion", err.Error()) // No further action required, object was modified, another reconcile will finish the job. } return reconcile.Result{}, nil } logt.Info("Kafka admin URL and/or APIKey not found", instance.Name, err.Error()) return ret, err } // Delete if necessary if instance.ObjectMeta.DeletionTimestamp.IsZero() { // Instance is not being deleted, add the finalizer if not present if !ContainsFinalizer(instance) { instance.ObjectMeta.Finalizers = append(instance.ObjectMeta.Finalizers, topicFinalizer) if err := r.Update(context.Background(), instance); err != nil { logt.Info("Error adding finalizer", instance.Name, err.Error()) return reconcile.Result{}, nil } } } else { // The object is being deleted if ContainsFinalizer(instance) { result, err := deleteTopic(kafkaAdminURL, apiKey, instance) if err != nil { logt.Info("Error deleting topic", "in deletion", err.Error()) return reconcile.Result{Requeue: true, RequeueAfter: time.Second * 10}, nil } if result.StatusCode == 202 || result.StatusCode == 404 { // deletion succeeded or topic does not exist // remove our finalizer from the list and update it. err := r.deleteConfigMap(instance) if err != nil { return reconcile.Result{Requeue: true, RequeueAfter: time.Second * 10}, nil } instance.ObjectMeta.Finalizers = DeleteFinalizer(instance) if err := r.Update(context.Background(), instance); err != nil { logt.Info("Error removing finalizers", "in deletion", err.Error()) } return reconcile.Result{}, nil } } } logt.Info("Getting", "topic", instance.Name) result, err := getTopic(kafkaAdminURL, apiKey, instance) logt.Info("Result of Get", instance.Name, result.StatusCode) if result.StatusCode == 405 && strings.Contains(result.Body, "Method Not Allowed") { logt.Info("Trying to create", "topic", instance.Name) // This must be a CF Messagehub, does not support GET, test by trying to create result, err = createTopic(ctx, kafkaAdminURL, apiKey, instance) logt.Info("Creation result", instance.Name, result) if result.StatusCode == 200 { // Success logt.Info("Topic created", "success", instance.Name) return r.updateStatusOnline(kafkaAdminURL, apiKey, instance) } else if strings.Contains(result.Body, "already exists") { logt.Info("Topic already exists", "success", instance.Name) return r.updateStatusOnline(kafkaAdminURL, apiKey, instance) } if err != nil { logt.Info("Topic creation", "error", err.Error()) return r.updateStatusError(instance, "Failed", err.Error()) } logt.Info("Topic creation error", instance.Name, result.Body) return r.updateStatusError(instance, "Failed", result.Body) } else if result.StatusCode == 200 { // TODO: check that the configuration is the same return r.updateStatusOnline(kafkaAdminURL, apiKey, instance) } else if result.StatusCode == 404 && strings.Contains(result.Body, "unable to get topic details") { // Need to create the topic result, err = createTopic(ctx, kafkaAdminURL, apiKey, instance) if err != nil { logt.Info("Topic creation error", instance.Name, err.Error()) return r.updateStatusError(instance, "Failed", err.Error()) } if result.StatusCode != 200 && result.StatusCode != 202 { logt.Info("Topic creation error", instance.Name, result.StatusCode) return r.updateStatusError(instance, "Failed", result.Body) } return r.updateStatusOnline(kafkaAdminURL, apiKey, instance) } else { return reconcile.Result{Requeue: true, RequeueAfter: time.Second * 20}, nil } } func (r *ReconcileTopic) updateStatusError(instance *ibmcloudv1alpha1.Topic, state string, message string) (reconcile.Result, error) { logt.Info(message) if strings.Contains(message, "dial tcp: lookup iam.cloud.ibm.com: no such host") || strings.Contains(message, "dial tcp: lookup login.ng.bluemix.net: no such host") { // This means that the IBM Cloud server is under too much pressure, we need to back up if instance.Status.State != state { instance.Status.Message = "Temporarily lost connection to server" instance.Status.State = "Pending" if err := r.Status().Update(context.Background(), instance); err != nil { logt.Info("Error updating status", state, err.Error()) } } return reconcile.Result{Requeue: true, RequeueAfter: time.Minute * 3}, nil } if instance.Status.State != state { instance.Status.State = state instance.Status.Message = message if err := r.Status().Update(context.Background(), instance); err != nil { logt.Info("Error updating status", state, err.Error()) return reconcile.Result{}, nil } } return reconcile.Result{Requeue: true, RequeueAfter: time.Minute * 1}, nil } func (r *ReconcileTopic) updateStatusOnline(kafkaAdminURL string, apiKey string, instance *ibmcloudv1alpha1.Topic) (reconcile.Result, error) { instance.Status.State = "Online" instance.Status.Message = "Online" err := r.Status().Update(context.Background(), instance) if err != nil { logt.Info("Failed to update online status, will delete external resource ", instance.ObjectMeta.Name, err.Error()) res, err := deleteTopic(kafkaAdminURL, apiKey, instance) if err != nil || (res.StatusCode != 202 && res.StatusCode != 404) { logt.Info("Failed to delete external resource, operator state and external resource might be in an inconsistent state", instance.ObjectMeta.Name, err.Error()) } err = r.deleteConfigMap(instance) if err != nil { logt.Info("Failed to delete configMap", instance.ObjectMeta.Name, err.Error()) return reconcile.Result{Requeue: true, RequeueAfter: time.Second * 10}, nil } } else { // Now check or create a configMap with info about the topic err = r.checkConfigMap(instance) if err != nil { return r.updateStatusError(instance, "Failed", err.Error()) } } return reconcile.Result{Requeue: true, RequeueAfter: time.Second * 30}, nil } // This function checks that a configMap exists with the same name and namespace as the Topic object, with info about external func (r *ReconcileTopic) checkConfigMap(instance *ibmcloudv1alpha1.Topic) error { configMap := &corev1.ConfigMap{} err := r.Get(context.Background(), types.NamespacedName{Name: instance.ObjectMeta.Name, Namespace: instance.ObjectMeta.Namespace}, configMap) if err != nil { // ConfigMap does not exist, recreate it err = r.createConfigMap(instance) if err != nil { return err } } else { // ConfigMap exists, check the content if configMap.Data["Topic"] != instance.Spec.TopicName { // Content not the same, update configMap configMap.Data["Topic"] = instance.Spec.TopicName if err := r.Update(context.Background(), configMap); err != nil { return err } } } return nil } func (r *ReconcileTopic) createConfigMap(instance *ibmcloudv1alpha1.Topic) error { logt.Info("Creating ", "ConfigMap", instance.ObjectMeta.Name) configMap := &corev1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ Name: instance.ObjectMeta.Name, Namespace: instance.Namespace, }, Data: map[string]string{ "Topic": instance.Spec.TopicName, }, } if err := controllerutil.SetControllerReference(instance, configMap, r.scheme); err != nil { return err } if err := r.Create(context.Background(), configMap); err != nil { return err } return nil } func (r *ReconcileTopic) deleteConfigMap(instance *ibmcloudv1alpha1.Topic) error { logt.Info("Deleting ", "configmap", instance.Name) configMap := &corev1.ConfigMap{} err := r.Get(context.Background(), types.NamespacedName{Name: instance.ObjectMeta.Name, Namespace: instance.ObjectMeta.Namespace}, configMap) if err != nil { // nothing to do return nil } // delete the configMap if err := r.Delete(context.Background(), configMap); err != nil { return err } return nil } func isWellFormed(instance ibmcloudv1alpha1.Topic) bool { if instance.Spec.BindingFrom.Name != "" { if instance.Spec.APIKey != nil { return false } if instance.Spec.KafkaAdminURL != nil { return false } } if instance.Spec.APIKey != nil && instance.Spec.KafkaAdminURL == nil { return false } if instance.Spec.APIKey != nil && instance.Spec.KafkaAdminURL == nil { return false } return true }
package main import "fmt" func value(number int) int { defer fmt.Println("end") if number > 5000 { fmt.Println("High Value") return number } else { fmt.Println("Low Value") return number } } func main() { fmt.Println(value(6000)) fmt.Println(value(2000)) }
package main import ( "fmt" "io/ioutil" "log" "path/filepath" "runtime" "strconv" "strings" ) func main() { _, file, _, _ := runtime.Caller(0) content, err := ioutil.ReadFile(filepath.Join(filepath.Dir(file), "./input.txt")) if err != nil { log.Fatalln("load input error:", err) } rawInput := strings.Split(string(content), "\n") rawInput = append(rawInput, "") passport := map[string]string{} emptyPassport(passport) valid := 0 for i := 0; i < len(rawInput); i++ { if rawInput[i] == "" { if isPassportValid(passport) { valid++ } emptyPassport(passport) continue } for _, input := range strings.Split(rawInput[i], " ") { kv := strings.Split(string(input), ":") passport[kv[0]] = kv[1] } } fmt.Println("valid:", valid) } func emptyPassport(m map[string]string) { m["byr"] = "" m["iyr"] = "" m["eyr"] = "" m["hgt"] = "" m["hcl"] = "" m["ecl"] = "" m["pid"] = "" m["cid"] = "" } func isPassportValid(m map[string]string) bool { // byr (Birth Year) - four digits; at least 1920 and at most 2002. if m["byr"] == "" { return false } byr, err := strconv.Atoi(m["byr"]) if err != nil { panic(err) } if byr < 1920 || byr > 2002 { return false } // iyr (Issue Year) - four digits; at least 2010 and at most 2020. if m["iyr"] == "" { return false } iyr, err := strconv.Atoi(m["iyr"]) if err != nil { panic(err) } if iyr < 2010 || iyr > 2020 { return false } // eyr (Expiration Year) - four digits; at least 2020 and at most 2030. if m["eyr"] == "" { return false } eyr, err := strconv.Atoi(m["eyr"]) if err != nil { panic(err) } if eyr < 2020 || eyr > 2030 { return false } // hgt (Height) - a number followed by either cm or in: // If cm, the number must be at least 150 and at most 193. // If in, the number must be at least 59 and at most 76. if len(m["hgt"]) == 5 { if m["hgt"][3] != 'c' || m["hgt"][4] != 'm' { return false } hgt, err := strconv.Atoi(m["hgt"][:3]) if err != nil { panic(err) } if hgt < 150 || hgt > 193 { return false } } else if len(m["hgt"]) == 4 { if m["hgt"][2] != 'i' || m["hgt"][3] != 'n' { return false } hgt, err := strconv.Atoi(m["hgt"][:2]) if err != nil { panic(err) } if hgt < 59 || hgt > 76 { return false } } else { return false } // hcl (Hair Color) - a # followed by exactly six characters 0-9 or a-f. if len(m["hcl"]) != 7 { return false } if m["hcl"][0] != '#' { return false } for i := 1; i < 7; i++ { ch := m["hcl"][i] if ch >= 'a' && ch <= 'f' { continue } if ch >= '0' && ch <= '9' { continue } return false } // ecl (Eye Color) - exactly one of: amb blu brn gry grn hzl oth. if m["ecl"] != "amb" && m["ecl"] != "blu" && m["ecl"] != "brn" && m["ecl"] != "gry" && m["ecl"] != "grn" && m["ecl"] != "hzl" && m["ecl"] != "oth" { return false } // pid (Passport ID) - a nine-digit number, including leading zeroes. if len(m["pid"]) != 9 { return false } for i := 0; i < 9; i++ { if m["pid"][i] < '0' || m["pid"][i] > '9' { return false } } return true }
package ws_test import ( "net/http" "net/http/httptest" "net/url" "time" "github.com/emicklei/go-restful" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" error_types "github.com/kumahq/kuma/pkg/core/rest/errors/types" "github.com/kumahq/kuma/pkg/core/secrets/cipher" secret_manager "github.com/kumahq/kuma/pkg/core/secrets/manager" secret_store "github.com/kumahq/kuma/pkg/core/secrets/store" "github.com/kumahq/kuma/pkg/core/user" "github.com/kumahq/kuma/pkg/plugins/authn/api-server/tokens/issuer" "github.com/kumahq/kuma/pkg/plugins/authn/api-server/tokens/ws/client" "github.com/kumahq/kuma/pkg/plugins/authn/api-server/tokens/ws/server" "github.com/kumahq/kuma/pkg/plugins/resources/memory" util_http "github.com/kumahq/kuma/pkg/util/http" ) type noopGenerateUserTokenAccess struct { } func (n *noopGenerateUserTokenAccess) ValidateGenerate(user.User) error { return nil } var _ = Describe("Auth Tokens WS", func() { var userTokenClient client.UserTokenClient var userTokenValidator issuer.UserTokenValidator BeforeEach(func() { store := memory.NewStore() manager := secret_manager.NewGlobalSecretManager(secret_store.NewSecretStore(store), cipher.None()) signingKeyManager := issuer.NewSigningKeyManager(manager) userTokenValidator = issuer.NewUserTokenValidator(issuer.NewSigningKeyAccessor(manager), issuer.NewTokenRevocations(manager)) Expect(signingKeyManager.CreateDefaultSigningKey()).To(Succeed()) ws := server.NewWebService(issuer.NewUserTokenIssuer(signingKeyManager), &noopGenerateUserTokenAccess{}) container := restful.NewContainer() container.Add(ws) srv := httptest.NewServer(container) baseURL, err := url.Parse(srv.URL) Expect(err).ToNot(HaveOccurred()) userTokenClient = client.NewHTTPUserTokenClient(util_http.ClientWithBaseURL(http.DefaultClient, baseURL, nil)) // wait for the server Eventually(func() error { _, err := userTokenClient.Generate("john.doe@example.com", []string{"team-a"}, 0) return err }).ShouldNot(HaveOccurred()) }) It("should generate token", func() { // when token, err := userTokenClient.Generate("john.doe@example.com", []string{"team-a"}, 1*time.Hour) // then Expect(err).ToNot(HaveOccurred()) u, err := userTokenValidator.Validate(token) Expect(err).ToNot(HaveOccurred()) Expect(u.Name).To(Equal("john.doe@example.com")) Expect(u.Groups).To(Equal([]string{"team-a"})) }) It("should throw an error when zone is not passed", func() { // when _, err := userTokenClient.Generate("", nil, 1*time.Hour) // then Expect(err).To(Equal(&error_types.Error{ Title: "Invalid request", Details: "Resource is not valid", Causes: []error_types.Cause{ { Field: "name", Message: "cannot be empty", }, }, })) }) })
package response import "time" type AnimeResponse struct { RequestHash string `json:"request_hash"` RequestCached bool `json:"request_cached"` RequestCacheExpiry int `json:"request_cache_expiry"` MalID int `json:"mal_id"` URL string `json:"url"` ImageURL string `json:"image_url"` TrailerURL string `json:"trailer_url"` Title string `json:"title"` TitleEnglish string `json:"title_english"` TitleJapanese string `json:"title_japanese"` TitleSynonyms []interface{} `json:"title_synonyms"` Type string `json:"type"` Source string `json:"source"` Episodes int `json:"episodes"` Status string `json:"status"` Airing bool `json:"airing"` Aired struct { From time.Time `json:"from"` To time.Time `json:"to"` Prop struct { From struct { Day int `json:"day"` Month int `json:"month"` Year int `json:"year"` } `json:"from"` To struct { Day int `json:"day"` Month int `json:"month"` Year int `json:"year"` } `json:"to"` } `json:"prop"` String string `json:"string"` } `json:"aired"` Duration string `json:"duration"` Rating string `json:"rating"` Score float64 `json:"score"` ScoredBy int `json:"scored_by"` Rank int `json:"rank"` Popularity int `json:"popularity"` Members int `json:"members"` Favorites int `json:"favorites"` Synopsis string `json:"synopsis"` Background interface{} `json:"background"` Premiered string `json:"premiered"` Broadcast string `json:"broadcast"` Related struct { Adaptation []struct { MalID int `json:"mal_id"` Type string `json:"type"` Name string `json:"name"` URL string `json:"url"` } `json:"Adaptation"` Prequel []struct { MalID int `json:"mal_id"` Type string `json:"type"` Name string `json:"name"` URL string `json:"url"` } `json:"Prequel"` Other []struct { MalID int `json:"mal_id"` Type string `json:"type"` Name string `json:"name"` URL string `json:"url"` } `json:"Other"` } `json:"related"` Producers []interface{} `json:"producers"` Licensors []struct { MalID int `json:"mal_id"` Type string `json:"type"` Name string `json:"name"` URL string `json:"url"` } `json:"licensors"` Studios []struct { MalID int `json:"mal_id"` Type string `json:"type"` Name string `json:"name"` URL string `json:"url"` } `json:"studios"` Genres []struct { MalID int `json:"mal_id"` Type string `json:"type"` Name string `json:"name"` URL string `json:"url"` } `json:"genres"` OpeningThemes []string `json:"opening_themes"` EndingThemes []string `json:"ending_themes"` }
// Copyright 2021 Google LLC. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package server import ( "context" "github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl" emptypb "github.com/GoogleCloudPlatform/declarative-resource-client-library/python/proto/empty_go_proto" alphapb "github.com/GoogleCloudPlatform/declarative-resource-client-library/python/proto/tier2/alpha/tier2_alpha_go_proto" "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/tier2/alpha" ) // Server implements the gRPC interface for Instance. type InstanceServer struct{} // ProtoToInstanceSkuTierEnum converts a InstanceSkuTierEnum enum from its proto representation. func ProtoToTier2AlphaInstanceSkuTierEnum(e alphapb.Tier2AlphaInstanceSkuTierEnum) *alpha.InstanceSkuTierEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceSkuTierEnum_name[int32(e)]; ok { e := alpha.InstanceSkuTierEnum(n[len("Tier2AlphaInstanceSkuTierEnum"):]) return &e } return nil } // ProtoToInstanceSkuSizeEnum converts a InstanceSkuSizeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceSkuSizeEnum(e alphapb.Tier2AlphaInstanceSkuSizeEnum) *alpha.InstanceSkuSizeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceSkuSizeEnum_name[int32(e)]; ok { e := alpha.InstanceSkuSizeEnum(n[len("Tier2AlphaInstanceSkuSizeEnum"):]) return &e } return nil } // ProtoToInstanceStateEnum converts a InstanceStateEnum enum from its proto representation. func ProtoToTier2AlphaInstanceStateEnum(e alphapb.Tier2AlphaInstanceStateEnum) *alpha.InstanceStateEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceStateEnum_name[int32(e)]; ok { e := alpha.InstanceStateEnum(n[len("Tier2AlphaInstanceStateEnum"):]) return &e } return nil } // ProtoToInstanceEncryptionKeysKeyStateAvailabilityKeyVersionStateEnum converts a InstanceEncryptionKeysKeyStateAvailabilityKeyVersionStateEnum enum from its proto representation. func ProtoToTier2AlphaInstanceEncryptionKeysKeyStateAvailabilityKeyVersionStateEnum(e alphapb.Tier2AlphaInstanceEncryptionKeysKeyStateAvailabilityKeyVersionStateEnum) *alpha.InstanceEncryptionKeysKeyStateAvailabilityKeyVersionStateEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceEncryptionKeysKeyStateAvailabilityKeyVersionStateEnum_name[int32(e)]; ok { e := alpha.InstanceEncryptionKeysKeyStateAvailabilityKeyVersionStateEnum(n[len("Tier2AlphaInstanceEncryptionKeysKeyStateAvailabilityKeyVersionStateEnum"):]) return &e } return nil } // ProtoToInstancePreprocessCreateRecipeStepsActionEnum converts a InstancePreprocessCreateRecipeStepsActionEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsActionEnum(e alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsActionEnum) *alpha.InstancePreprocessCreateRecipeStepsActionEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsActionEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessCreateRecipeStepsActionEnum(n[len("Tier2AlphaInstancePreprocessCreateRecipeStepsActionEnum"):]) return &e } return nil } // ProtoToInstancePreprocessCreateRecipeStepsRequestedTenantProjectScopeEnum converts a InstancePreprocessCreateRecipeStepsRequestedTenantProjectScopeEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsRequestedTenantProjectScopeEnum(e alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsRequestedTenantProjectScopeEnum) *alpha.InstancePreprocessCreateRecipeStepsRequestedTenantProjectScopeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsRequestedTenantProjectScopeEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessCreateRecipeStepsRequestedTenantProjectScopeEnum(n[len("Tier2AlphaInstancePreprocessCreateRecipeStepsRequestedTenantProjectScopeEnum"):]) return &e } return nil } // ProtoToInstancePreprocessCreateRecipeStepsPermissionsInfoPolicyNameModeEnum converts a InstancePreprocessCreateRecipeStepsPermissionsInfoPolicyNameModeEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoPolicyNameModeEnum(e alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoPolicyNameModeEnum) *alpha.InstancePreprocessCreateRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoPolicyNameModeEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessCreateRecipeStepsPermissionsInfoPolicyNameModeEnum(n[len("Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoPolicyNameModeEnum"):]) return &e } return nil } // ProtoToInstanceCreateRecipeStepsActionEnum converts a InstanceCreateRecipeStepsActionEnum enum from its proto representation. func ProtoToTier2AlphaInstanceCreateRecipeStepsActionEnum(e alphapb.Tier2AlphaInstanceCreateRecipeStepsActionEnum) *alpha.InstanceCreateRecipeStepsActionEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceCreateRecipeStepsActionEnum_name[int32(e)]; ok { e := alpha.InstanceCreateRecipeStepsActionEnum(n[len("Tier2AlphaInstanceCreateRecipeStepsActionEnum"):]) return &e } return nil } // ProtoToInstanceCreateRecipeStepsRequestedTenantProjectScopeEnum converts a InstanceCreateRecipeStepsRequestedTenantProjectScopeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceCreateRecipeStepsRequestedTenantProjectScopeEnum(e alphapb.Tier2AlphaInstanceCreateRecipeStepsRequestedTenantProjectScopeEnum) *alpha.InstanceCreateRecipeStepsRequestedTenantProjectScopeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceCreateRecipeStepsRequestedTenantProjectScopeEnum_name[int32(e)]; ok { e := alpha.InstanceCreateRecipeStepsRequestedTenantProjectScopeEnum(n[len("Tier2AlphaInstanceCreateRecipeStepsRequestedTenantProjectScopeEnum"):]) return &e } return nil } // ProtoToInstanceCreateRecipeStepsPermissionsInfoPolicyNameModeEnum converts a InstanceCreateRecipeStepsPermissionsInfoPolicyNameModeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceCreateRecipeStepsPermissionsInfoPolicyNameModeEnum(e alphapb.Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoPolicyNameModeEnum) *alpha.InstanceCreateRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoPolicyNameModeEnum_name[int32(e)]; ok { e := alpha.InstanceCreateRecipeStepsPermissionsInfoPolicyNameModeEnum(n[len("Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoPolicyNameModeEnum"):]) return &e } return nil } // ProtoToInstanceDeleteRecipeStepsActionEnum converts a InstanceDeleteRecipeStepsActionEnum enum from its proto representation. func ProtoToTier2AlphaInstanceDeleteRecipeStepsActionEnum(e alphapb.Tier2AlphaInstanceDeleteRecipeStepsActionEnum) *alpha.InstanceDeleteRecipeStepsActionEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceDeleteRecipeStepsActionEnum_name[int32(e)]; ok { e := alpha.InstanceDeleteRecipeStepsActionEnum(n[len("Tier2AlphaInstanceDeleteRecipeStepsActionEnum"):]) return &e } return nil } // ProtoToInstanceDeleteRecipeStepsRequestedTenantProjectScopeEnum converts a InstanceDeleteRecipeStepsRequestedTenantProjectScopeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceDeleteRecipeStepsRequestedTenantProjectScopeEnum(e alphapb.Tier2AlphaInstanceDeleteRecipeStepsRequestedTenantProjectScopeEnum) *alpha.InstanceDeleteRecipeStepsRequestedTenantProjectScopeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceDeleteRecipeStepsRequestedTenantProjectScopeEnum_name[int32(e)]; ok { e := alpha.InstanceDeleteRecipeStepsRequestedTenantProjectScopeEnum(n[len("Tier2AlphaInstanceDeleteRecipeStepsRequestedTenantProjectScopeEnum"):]) return &e } return nil } // ProtoToInstanceDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum converts a InstanceDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum(e alphapb.Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum) *alpha.InstanceDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum_name[int32(e)]; ok { e := alpha.InstanceDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum(n[len("Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum"):]) return &e } return nil } // ProtoToInstanceUpdateRecipeStepsActionEnum converts a InstanceUpdateRecipeStepsActionEnum enum from its proto representation. func ProtoToTier2AlphaInstanceUpdateRecipeStepsActionEnum(e alphapb.Tier2AlphaInstanceUpdateRecipeStepsActionEnum) *alpha.InstanceUpdateRecipeStepsActionEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceUpdateRecipeStepsActionEnum_name[int32(e)]; ok { e := alpha.InstanceUpdateRecipeStepsActionEnum(n[len("Tier2AlphaInstanceUpdateRecipeStepsActionEnum"):]) return &e } return nil } // ProtoToInstanceUpdateRecipeStepsRequestedTenantProjectScopeEnum converts a InstanceUpdateRecipeStepsRequestedTenantProjectScopeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceUpdateRecipeStepsRequestedTenantProjectScopeEnum(e alphapb.Tier2AlphaInstanceUpdateRecipeStepsRequestedTenantProjectScopeEnum) *alpha.InstanceUpdateRecipeStepsRequestedTenantProjectScopeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceUpdateRecipeStepsRequestedTenantProjectScopeEnum_name[int32(e)]; ok { e := alpha.InstanceUpdateRecipeStepsRequestedTenantProjectScopeEnum(n[len("Tier2AlphaInstanceUpdateRecipeStepsRequestedTenantProjectScopeEnum"):]) return &e } return nil } // ProtoToInstanceUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum converts a InstanceUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum(e alphapb.Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum) *alpha.InstanceUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum_name[int32(e)]; ok { e := alpha.InstanceUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum(n[len("Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum"):]) return &e } return nil } // ProtoToInstancePreprocessResetRecipeStepsActionEnum converts a InstancePreprocessResetRecipeStepsActionEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessResetRecipeStepsActionEnum(e alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsActionEnum) *alpha.InstancePreprocessResetRecipeStepsActionEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsActionEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessResetRecipeStepsActionEnum(n[len("Tier2AlphaInstancePreprocessResetRecipeStepsActionEnum"):]) return &e } return nil } // ProtoToInstancePreprocessResetRecipeStepsRequestedTenantProjectScopeEnum converts a InstancePreprocessResetRecipeStepsRequestedTenantProjectScopeEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessResetRecipeStepsRequestedTenantProjectScopeEnum(e alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsRequestedTenantProjectScopeEnum) *alpha.InstancePreprocessResetRecipeStepsRequestedTenantProjectScopeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsRequestedTenantProjectScopeEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessResetRecipeStepsRequestedTenantProjectScopeEnum(n[len("Tier2AlphaInstancePreprocessResetRecipeStepsRequestedTenantProjectScopeEnum"):]) return &e } return nil } // ProtoToInstancePreprocessResetRecipeStepsPermissionsInfoPolicyNameModeEnum converts a InstancePreprocessResetRecipeStepsPermissionsInfoPolicyNameModeEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoPolicyNameModeEnum(e alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoPolicyNameModeEnum) *alpha.InstancePreprocessResetRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoPolicyNameModeEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessResetRecipeStepsPermissionsInfoPolicyNameModeEnum(n[len("Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoPolicyNameModeEnum"):]) return &e } return nil } // ProtoToInstanceResetRecipeStepsActionEnum converts a InstanceResetRecipeStepsActionEnum enum from its proto representation. func ProtoToTier2AlphaInstanceResetRecipeStepsActionEnum(e alphapb.Tier2AlphaInstanceResetRecipeStepsActionEnum) *alpha.InstanceResetRecipeStepsActionEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceResetRecipeStepsActionEnum_name[int32(e)]; ok { e := alpha.InstanceResetRecipeStepsActionEnum(n[len("Tier2AlphaInstanceResetRecipeStepsActionEnum"):]) return &e } return nil } // ProtoToInstanceResetRecipeStepsRequestedTenantProjectScopeEnum converts a InstanceResetRecipeStepsRequestedTenantProjectScopeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceResetRecipeStepsRequestedTenantProjectScopeEnum(e alphapb.Tier2AlphaInstanceResetRecipeStepsRequestedTenantProjectScopeEnum) *alpha.InstanceResetRecipeStepsRequestedTenantProjectScopeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceResetRecipeStepsRequestedTenantProjectScopeEnum_name[int32(e)]; ok { e := alpha.InstanceResetRecipeStepsRequestedTenantProjectScopeEnum(n[len("Tier2AlphaInstanceResetRecipeStepsRequestedTenantProjectScopeEnum"):]) return &e } return nil } // ProtoToInstanceResetRecipeStepsPermissionsInfoPolicyNameModeEnum converts a InstanceResetRecipeStepsPermissionsInfoPolicyNameModeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceResetRecipeStepsPermissionsInfoPolicyNameModeEnum(e alphapb.Tier2AlphaInstanceResetRecipeStepsPermissionsInfoPolicyNameModeEnum) *alpha.InstanceResetRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceResetRecipeStepsPermissionsInfoPolicyNameModeEnum_name[int32(e)]; ok { e := alpha.InstanceResetRecipeStepsPermissionsInfoPolicyNameModeEnum(n[len("Tier2AlphaInstanceResetRecipeStepsPermissionsInfoPolicyNameModeEnum"):]) return &e } return nil } // ProtoToInstancePreprocessRepairRecipeStepsActionEnum converts a InstancePreprocessRepairRecipeStepsActionEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsActionEnum(e alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsActionEnum) *alpha.InstancePreprocessRepairRecipeStepsActionEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsActionEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessRepairRecipeStepsActionEnum(n[len("Tier2AlphaInstancePreprocessRepairRecipeStepsActionEnum"):]) return &e } return nil } // ProtoToInstancePreprocessRepairRecipeStepsRequestedTenantProjectScopeEnum converts a InstancePreprocessRepairRecipeStepsRequestedTenantProjectScopeEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsRequestedTenantProjectScopeEnum(e alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsRequestedTenantProjectScopeEnum) *alpha.InstancePreprocessRepairRecipeStepsRequestedTenantProjectScopeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsRequestedTenantProjectScopeEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessRepairRecipeStepsRequestedTenantProjectScopeEnum(n[len("Tier2AlphaInstancePreprocessRepairRecipeStepsRequestedTenantProjectScopeEnum"):]) return &e } return nil } // ProtoToInstancePreprocessRepairRecipeStepsPermissionsInfoPolicyNameModeEnum converts a InstancePreprocessRepairRecipeStepsPermissionsInfoPolicyNameModeEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoPolicyNameModeEnum(e alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoPolicyNameModeEnum) *alpha.InstancePreprocessRepairRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoPolicyNameModeEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessRepairRecipeStepsPermissionsInfoPolicyNameModeEnum(n[len("Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoPolicyNameModeEnum"):]) return &e } return nil } // ProtoToInstanceRepairRecipeStepsActionEnum converts a InstanceRepairRecipeStepsActionEnum enum from its proto representation. func ProtoToTier2AlphaInstanceRepairRecipeStepsActionEnum(e alphapb.Tier2AlphaInstanceRepairRecipeStepsActionEnum) *alpha.InstanceRepairRecipeStepsActionEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceRepairRecipeStepsActionEnum_name[int32(e)]; ok { e := alpha.InstanceRepairRecipeStepsActionEnum(n[len("Tier2AlphaInstanceRepairRecipeStepsActionEnum"):]) return &e } return nil } // ProtoToInstanceRepairRecipeStepsRequestedTenantProjectScopeEnum converts a InstanceRepairRecipeStepsRequestedTenantProjectScopeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceRepairRecipeStepsRequestedTenantProjectScopeEnum(e alphapb.Tier2AlphaInstanceRepairRecipeStepsRequestedTenantProjectScopeEnum) *alpha.InstanceRepairRecipeStepsRequestedTenantProjectScopeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceRepairRecipeStepsRequestedTenantProjectScopeEnum_name[int32(e)]; ok { e := alpha.InstanceRepairRecipeStepsRequestedTenantProjectScopeEnum(n[len("Tier2AlphaInstanceRepairRecipeStepsRequestedTenantProjectScopeEnum"):]) return &e } return nil } // ProtoToInstanceRepairRecipeStepsPermissionsInfoPolicyNameModeEnum converts a InstanceRepairRecipeStepsPermissionsInfoPolicyNameModeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceRepairRecipeStepsPermissionsInfoPolicyNameModeEnum(e alphapb.Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoPolicyNameModeEnum) *alpha.InstanceRepairRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoPolicyNameModeEnum_name[int32(e)]; ok { e := alpha.InstanceRepairRecipeStepsPermissionsInfoPolicyNameModeEnum(n[len("Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoPolicyNameModeEnum"):]) return &e } return nil } // ProtoToInstancePreprocessDeleteRecipeStepsActionEnum converts a InstancePreprocessDeleteRecipeStepsActionEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsActionEnum(e alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsActionEnum) *alpha.InstancePreprocessDeleteRecipeStepsActionEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsActionEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessDeleteRecipeStepsActionEnum(n[len("Tier2AlphaInstancePreprocessDeleteRecipeStepsActionEnum"):]) return &e } return nil } // ProtoToInstancePreprocessDeleteRecipeStepsRequestedTenantProjectScopeEnum converts a InstancePreprocessDeleteRecipeStepsRequestedTenantProjectScopeEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsRequestedTenantProjectScopeEnum(e alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsRequestedTenantProjectScopeEnum) *alpha.InstancePreprocessDeleteRecipeStepsRequestedTenantProjectScopeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsRequestedTenantProjectScopeEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessDeleteRecipeStepsRequestedTenantProjectScopeEnum(n[len("Tier2AlphaInstancePreprocessDeleteRecipeStepsRequestedTenantProjectScopeEnum"):]) return &e } return nil } // ProtoToInstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum converts a InstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum(e alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum) *alpha.InstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum(n[len("Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum"):]) return &e } return nil } // ProtoToInstancePreprocessUpdateRecipeStepsActionEnum converts a InstancePreprocessUpdateRecipeStepsActionEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsActionEnum(e alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsActionEnum) *alpha.InstancePreprocessUpdateRecipeStepsActionEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsActionEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessUpdateRecipeStepsActionEnum(n[len("Tier2AlphaInstancePreprocessUpdateRecipeStepsActionEnum"):]) return &e } return nil } // ProtoToInstancePreprocessUpdateRecipeStepsRequestedTenantProjectScopeEnum converts a InstancePreprocessUpdateRecipeStepsRequestedTenantProjectScopeEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsRequestedTenantProjectScopeEnum(e alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsRequestedTenantProjectScopeEnum) *alpha.InstancePreprocessUpdateRecipeStepsRequestedTenantProjectScopeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsRequestedTenantProjectScopeEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessUpdateRecipeStepsRequestedTenantProjectScopeEnum(n[len("Tier2AlphaInstancePreprocessUpdateRecipeStepsRequestedTenantProjectScopeEnum"):]) return &e } return nil } // ProtoToInstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum converts a InstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum(e alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum) *alpha.InstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum(n[len("Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum"):]) return &e } return nil } // ProtoToInstancePreprocessFreezeRecipeStepsActionEnum converts a InstancePreprocessFreezeRecipeStepsActionEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsActionEnum(e alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsActionEnum) *alpha.InstancePreprocessFreezeRecipeStepsActionEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsActionEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessFreezeRecipeStepsActionEnum(n[len("Tier2AlphaInstancePreprocessFreezeRecipeStepsActionEnum"):]) return &e } return nil } // ProtoToInstancePreprocessFreezeRecipeStepsRequestedTenantProjectScopeEnum converts a InstancePreprocessFreezeRecipeStepsRequestedTenantProjectScopeEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsRequestedTenantProjectScopeEnum(e alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsRequestedTenantProjectScopeEnum) *alpha.InstancePreprocessFreezeRecipeStepsRequestedTenantProjectScopeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsRequestedTenantProjectScopeEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessFreezeRecipeStepsRequestedTenantProjectScopeEnum(n[len("Tier2AlphaInstancePreprocessFreezeRecipeStepsRequestedTenantProjectScopeEnum"):]) return &e } return nil } // ProtoToInstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum converts a InstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(e alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum) *alpha.InstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(n[len("Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum"):]) return &e } return nil } // ProtoToInstanceFreezeRecipeStepsActionEnum converts a InstanceFreezeRecipeStepsActionEnum enum from its proto representation. func ProtoToTier2AlphaInstanceFreezeRecipeStepsActionEnum(e alphapb.Tier2AlphaInstanceFreezeRecipeStepsActionEnum) *alpha.InstanceFreezeRecipeStepsActionEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceFreezeRecipeStepsActionEnum_name[int32(e)]; ok { e := alpha.InstanceFreezeRecipeStepsActionEnum(n[len("Tier2AlphaInstanceFreezeRecipeStepsActionEnum"):]) return &e } return nil } // ProtoToInstanceFreezeRecipeStepsRequestedTenantProjectScopeEnum converts a InstanceFreezeRecipeStepsRequestedTenantProjectScopeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceFreezeRecipeStepsRequestedTenantProjectScopeEnum(e alphapb.Tier2AlphaInstanceFreezeRecipeStepsRequestedTenantProjectScopeEnum) *alpha.InstanceFreezeRecipeStepsRequestedTenantProjectScopeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceFreezeRecipeStepsRequestedTenantProjectScopeEnum_name[int32(e)]; ok { e := alpha.InstanceFreezeRecipeStepsRequestedTenantProjectScopeEnum(n[len("Tier2AlphaInstanceFreezeRecipeStepsRequestedTenantProjectScopeEnum"):]) return &e } return nil } // ProtoToInstanceFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum converts a InstanceFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(e alphapb.Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum) *alpha.InstanceFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum_name[int32(e)]; ok { e := alpha.InstanceFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(n[len("Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum"):]) return &e } return nil } // ProtoToInstancePreprocessUnfreezeRecipeStepsActionEnum converts a InstancePreprocessUnfreezeRecipeStepsActionEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsActionEnum(e alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsActionEnum) *alpha.InstancePreprocessUnfreezeRecipeStepsActionEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsActionEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessUnfreezeRecipeStepsActionEnum(n[len("Tier2AlphaInstancePreprocessUnfreezeRecipeStepsActionEnum"):]) return &e } return nil } // ProtoToInstancePreprocessUnfreezeRecipeStepsRequestedTenantProjectScopeEnum converts a InstancePreprocessUnfreezeRecipeStepsRequestedTenantProjectScopeEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsRequestedTenantProjectScopeEnum(e alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsRequestedTenantProjectScopeEnum) *alpha.InstancePreprocessUnfreezeRecipeStepsRequestedTenantProjectScopeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsRequestedTenantProjectScopeEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessUnfreezeRecipeStepsRequestedTenantProjectScopeEnum(n[len("Tier2AlphaInstancePreprocessUnfreezeRecipeStepsRequestedTenantProjectScopeEnum"):]) return &e } return nil } // ProtoToInstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum converts a InstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(e alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum) *alpha.InstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(n[len("Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum"):]) return &e } return nil } // ProtoToInstanceUnfreezeRecipeStepsActionEnum converts a InstanceUnfreezeRecipeStepsActionEnum enum from its proto representation. func ProtoToTier2AlphaInstanceUnfreezeRecipeStepsActionEnum(e alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsActionEnum) *alpha.InstanceUnfreezeRecipeStepsActionEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsActionEnum_name[int32(e)]; ok { e := alpha.InstanceUnfreezeRecipeStepsActionEnum(n[len("Tier2AlphaInstanceUnfreezeRecipeStepsActionEnum"):]) return &e } return nil } // ProtoToInstanceUnfreezeRecipeStepsRequestedTenantProjectScopeEnum converts a InstanceUnfreezeRecipeStepsRequestedTenantProjectScopeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceUnfreezeRecipeStepsRequestedTenantProjectScopeEnum(e alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsRequestedTenantProjectScopeEnum) *alpha.InstanceUnfreezeRecipeStepsRequestedTenantProjectScopeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsRequestedTenantProjectScopeEnum_name[int32(e)]; ok { e := alpha.InstanceUnfreezeRecipeStepsRequestedTenantProjectScopeEnum(n[len("Tier2AlphaInstanceUnfreezeRecipeStepsRequestedTenantProjectScopeEnum"):]) return &e } return nil } // ProtoToInstanceUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum converts a InstanceUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(e alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum) *alpha.InstanceUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum_name[int32(e)]; ok { e := alpha.InstanceUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(n[len("Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum"):]) return &e } return nil } // ProtoToInstancePreprocessReportInstanceHealthRecipeStepsActionEnum converts a InstancePreprocessReportInstanceHealthRecipeStepsActionEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsActionEnum(e alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsActionEnum) *alpha.InstancePreprocessReportInstanceHealthRecipeStepsActionEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsActionEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessReportInstanceHealthRecipeStepsActionEnum(n[len("Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsActionEnum"):]) return &e } return nil } // ProtoToInstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum converts a InstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum(e alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum) *alpha.InstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum(n[len("Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum"):]) return &e } return nil } // ProtoToInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum converts a InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum(e alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum) *alpha.InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum(n[len("Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum"):]) return &e } return nil } // ProtoToInstanceReportInstanceHealthRecipeStepsActionEnum converts a InstanceReportInstanceHealthRecipeStepsActionEnum enum from its proto representation. func ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsActionEnum(e alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsActionEnum) *alpha.InstanceReportInstanceHealthRecipeStepsActionEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsActionEnum_name[int32(e)]; ok { e := alpha.InstanceReportInstanceHealthRecipeStepsActionEnum(n[len("Tier2AlphaInstanceReportInstanceHealthRecipeStepsActionEnum"):]) return &e } return nil } // ProtoToInstanceReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum converts a InstanceReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum(e alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum) *alpha.InstanceReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum_name[int32(e)]; ok { e := alpha.InstanceReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum(n[len("Tier2AlphaInstanceReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum"):]) return &e } return nil } // ProtoToInstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum converts a InstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum(e alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum) *alpha.InstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum_name[int32(e)]; ok { e := alpha.InstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum(n[len("Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum"):]) return &e } return nil } // ProtoToInstancePreprocessGetRecipeStepsActionEnum converts a InstancePreprocessGetRecipeStepsActionEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessGetRecipeStepsActionEnum(e alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsActionEnum) *alpha.InstancePreprocessGetRecipeStepsActionEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsActionEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessGetRecipeStepsActionEnum(n[len("Tier2AlphaInstancePreprocessGetRecipeStepsActionEnum"):]) return &e } return nil } // ProtoToInstancePreprocessGetRecipeStepsRequestedTenantProjectScopeEnum converts a InstancePreprocessGetRecipeStepsRequestedTenantProjectScopeEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessGetRecipeStepsRequestedTenantProjectScopeEnum(e alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsRequestedTenantProjectScopeEnum) *alpha.InstancePreprocessGetRecipeStepsRequestedTenantProjectScopeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsRequestedTenantProjectScopeEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessGetRecipeStepsRequestedTenantProjectScopeEnum(n[len("Tier2AlphaInstancePreprocessGetRecipeStepsRequestedTenantProjectScopeEnum"):]) return &e } return nil } // ProtoToInstancePreprocessGetRecipeStepsPermissionsInfoPolicyNameModeEnum converts a InstancePreprocessGetRecipeStepsPermissionsInfoPolicyNameModeEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoPolicyNameModeEnum(e alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoPolicyNameModeEnum) *alpha.InstancePreprocessGetRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoPolicyNameModeEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessGetRecipeStepsPermissionsInfoPolicyNameModeEnum(n[len("Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoPolicyNameModeEnum"):]) return &e } return nil } // ProtoToInstanceNotifyKeyAvailableRecipeStepsActionEnum converts a InstanceNotifyKeyAvailableRecipeStepsActionEnum enum from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsActionEnum(e alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsActionEnum) *alpha.InstanceNotifyKeyAvailableRecipeStepsActionEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsActionEnum_name[int32(e)]; ok { e := alpha.InstanceNotifyKeyAvailableRecipeStepsActionEnum(n[len("Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsActionEnum"):]) return &e } return nil } // ProtoToInstanceNotifyKeyAvailableRecipeStepsRequestedTenantProjectScopeEnum converts a InstanceNotifyKeyAvailableRecipeStepsRequestedTenantProjectScopeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsRequestedTenantProjectScopeEnum(e alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsRequestedTenantProjectScopeEnum) *alpha.InstanceNotifyKeyAvailableRecipeStepsRequestedTenantProjectScopeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsRequestedTenantProjectScopeEnum_name[int32(e)]; ok { e := alpha.InstanceNotifyKeyAvailableRecipeStepsRequestedTenantProjectScopeEnum(n[len("Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsRequestedTenantProjectScopeEnum"):]) return &e } return nil } // ProtoToInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyNameModeEnum converts a InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyNameModeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyNameModeEnum(e alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyNameModeEnum) *alpha.InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyNameModeEnum_name[int32(e)]; ok { e := alpha.InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyNameModeEnum(n[len("Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyNameModeEnum"):]) return &e } return nil } // ProtoToInstanceNotifyKeyUnavailableRecipeStepsActionEnum converts a InstanceNotifyKeyUnavailableRecipeStepsActionEnum enum from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsActionEnum(e alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsActionEnum) *alpha.InstanceNotifyKeyUnavailableRecipeStepsActionEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsActionEnum_name[int32(e)]; ok { e := alpha.InstanceNotifyKeyUnavailableRecipeStepsActionEnum(n[len("Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsActionEnum"):]) return &e } return nil } // ProtoToInstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProjectScopeEnum converts a InstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProjectScopeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProjectScopeEnum(e alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProjectScopeEnum) *alpha.InstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProjectScopeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProjectScopeEnum_name[int32(e)]; ok { e := alpha.InstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProjectScopeEnum(n[len("Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProjectScopeEnum"):]) return &e } return nil } // ProtoToInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyNameModeEnum converts a InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyNameModeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyNameModeEnum(e alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyNameModeEnum) *alpha.InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyNameModeEnum_name[int32(e)]; ok { e := alpha.InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyNameModeEnum(n[len("Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyNameModeEnum"):]) return &e } return nil } // ProtoToInstanceReadonlyRecipeStepsActionEnum converts a InstanceReadonlyRecipeStepsActionEnum enum from its proto representation. func ProtoToTier2AlphaInstanceReadonlyRecipeStepsActionEnum(e alphapb.Tier2AlphaInstanceReadonlyRecipeStepsActionEnum) *alpha.InstanceReadonlyRecipeStepsActionEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceReadonlyRecipeStepsActionEnum_name[int32(e)]; ok { e := alpha.InstanceReadonlyRecipeStepsActionEnum(n[len("Tier2AlphaInstanceReadonlyRecipeStepsActionEnum"):]) return &e } return nil } // ProtoToInstanceReadonlyRecipeStepsRequestedTenantProjectScopeEnum converts a InstanceReadonlyRecipeStepsRequestedTenantProjectScopeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceReadonlyRecipeStepsRequestedTenantProjectScopeEnum(e alphapb.Tier2AlphaInstanceReadonlyRecipeStepsRequestedTenantProjectScopeEnum) *alpha.InstanceReadonlyRecipeStepsRequestedTenantProjectScopeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceReadonlyRecipeStepsRequestedTenantProjectScopeEnum_name[int32(e)]; ok { e := alpha.InstanceReadonlyRecipeStepsRequestedTenantProjectScopeEnum(n[len("Tier2AlphaInstanceReadonlyRecipeStepsRequestedTenantProjectScopeEnum"):]) return &e } return nil } // ProtoToInstanceReadonlyRecipeStepsPermissionsInfoPolicyNameModeEnum converts a InstanceReadonlyRecipeStepsPermissionsInfoPolicyNameModeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoPolicyNameModeEnum(e alphapb.Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoPolicyNameModeEnum) *alpha.InstanceReadonlyRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoPolicyNameModeEnum_name[int32(e)]; ok { e := alpha.InstanceReadonlyRecipeStepsPermissionsInfoPolicyNameModeEnum(n[len("Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoPolicyNameModeEnum"):]) return &e } return nil } // ProtoToInstanceReconcileRecipeStepsActionEnum converts a InstanceReconcileRecipeStepsActionEnum enum from its proto representation. func ProtoToTier2AlphaInstanceReconcileRecipeStepsActionEnum(e alphapb.Tier2AlphaInstanceReconcileRecipeStepsActionEnum) *alpha.InstanceReconcileRecipeStepsActionEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceReconcileRecipeStepsActionEnum_name[int32(e)]; ok { e := alpha.InstanceReconcileRecipeStepsActionEnum(n[len("Tier2AlphaInstanceReconcileRecipeStepsActionEnum"):]) return &e } return nil } // ProtoToInstanceReconcileRecipeStepsRequestedTenantProjectScopeEnum converts a InstanceReconcileRecipeStepsRequestedTenantProjectScopeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceReconcileRecipeStepsRequestedTenantProjectScopeEnum(e alphapb.Tier2AlphaInstanceReconcileRecipeStepsRequestedTenantProjectScopeEnum) *alpha.InstanceReconcileRecipeStepsRequestedTenantProjectScopeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceReconcileRecipeStepsRequestedTenantProjectScopeEnum_name[int32(e)]; ok { e := alpha.InstanceReconcileRecipeStepsRequestedTenantProjectScopeEnum(n[len("Tier2AlphaInstanceReconcileRecipeStepsRequestedTenantProjectScopeEnum"):]) return &e } return nil } // ProtoToInstanceReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum converts a InstanceReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum enum from its proto representation. func ProtoToTier2AlphaInstanceReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum(e alphapb.Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum) *alpha.InstanceReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum_name[int32(e)]; ok { e := alpha.InstanceReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum(n[len("Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum"):]) return &e } return nil } // ProtoToInstancePreprocessPassthroughRecipeStepsActionEnum converts a InstancePreprocessPassthroughRecipeStepsActionEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsActionEnum(e alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsActionEnum) *alpha.InstancePreprocessPassthroughRecipeStepsActionEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsActionEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessPassthroughRecipeStepsActionEnum(n[len("Tier2AlphaInstancePreprocessPassthroughRecipeStepsActionEnum"):]) return &e } return nil } // ProtoToInstancePreprocessPassthroughRecipeStepsRequestedTenantProjectScopeEnum converts a InstancePreprocessPassthroughRecipeStepsRequestedTenantProjectScopeEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsRequestedTenantProjectScopeEnum(e alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsRequestedTenantProjectScopeEnum) *alpha.InstancePreprocessPassthroughRecipeStepsRequestedTenantProjectScopeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsRequestedTenantProjectScopeEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessPassthroughRecipeStepsRequestedTenantProjectScopeEnum(n[len("Tier2AlphaInstancePreprocessPassthroughRecipeStepsRequestedTenantProjectScopeEnum"):]) return &e } return nil } // ProtoToInstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyNameModeEnum converts a InstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyNameModeEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyNameModeEnum(e alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyNameModeEnum) *alpha.InstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyNameModeEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyNameModeEnum(n[len("Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyNameModeEnum"):]) return &e } return nil } // ProtoToInstancePreprocessReconcileRecipeStepsActionEnum converts a InstancePreprocessReconcileRecipeStepsActionEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsActionEnum(e alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsActionEnum) *alpha.InstancePreprocessReconcileRecipeStepsActionEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsActionEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessReconcileRecipeStepsActionEnum(n[len("Tier2AlphaInstancePreprocessReconcileRecipeStepsActionEnum"):]) return &e } return nil } // ProtoToInstancePreprocessReconcileRecipeStepsRequestedTenantProjectScopeEnum converts a InstancePreprocessReconcileRecipeStepsRequestedTenantProjectScopeEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsRequestedTenantProjectScopeEnum(e alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsRequestedTenantProjectScopeEnum) *alpha.InstancePreprocessReconcileRecipeStepsRequestedTenantProjectScopeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsRequestedTenantProjectScopeEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessReconcileRecipeStepsRequestedTenantProjectScopeEnum(n[len("Tier2AlphaInstancePreprocessReconcileRecipeStepsRequestedTenantProjectScopeEnum"):]) return &e } return nil } // ProtoToInstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum converts a InstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum enum from its proto representation. func ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum(e alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum) *alpha.InstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == 0 { return nil } if n, ok := alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum_name[int32(e)]; ok { e := alpha.InstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum(n[len("Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum"):]) return &e } return nil } // ProtoToInstanceSku converts a InstanceSku resource from its proto representation. func ProtoToTier2AlphaInstanceSku(p *alphapb.Tier2AlphaInstanceSku) *alpha.InstanceSku { if p == nil { return nil } obj := &alpha.InstanceSku{ Tier: ProtoToTier2AlphaInstanceSkuTierEnum(p.GetTier()), Size: ProtoToTier2AlphaInstanceSkuSizeEnum(p.GetSize()), } return obj } // ProtoToInstanceReferences converts a InstanceReferences resource from its proto representation. func ProtoToTier2AlphaInstanceReferences(p *alphapb.Tier2AlphaInstanceReferences) *alpha.InstanceReferences { if p == nil { return nil } obj := &alpha.InstanceReferences{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), SourceResource: dcl.StringOrNil(p.SourceResource), CreateTime: dcl.StringOrNil(p.GetCreateTime()), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstanceReferencesDetails(r)) } return obj } // ProtoToInstanceReferencesDetails converts a InstanceReferencesDetails resource from its proto representation. func ProtoToTier2AlphaInstanceReferencesDetails(p *alphapb.Tier2AlphaInstanceReferencesDetails) *alpha.InstanceReferencesDetails { if p == nil { return nil } obj := &alpha.InstanceReferencesDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstanceEncryptionKeys converts a InstanceEncryptionKeys resource from its proto representation. func ProtoToTier2AlphaInstanceEncryptionKeys(p *alphapb.Tier2AlphaInstanceEncryptionKeys) *alpha.InstanceEncryptionKeys { if p == nil { return nil } obj := &alpha.InstanceEncryptionKeys{ KeyOrVersion: dcl.StringOrNil(p.KeyOrVersion), Grant: dcl.StringOrNil(p.Grant), Delegate: dcl.StringOrNil(p.Delegate), KeyState: ProtoToTier2AlphaInstanceEncryptionKeysKeyState(p.GetKeyState()), } return obj } // ProtoToInstanceEncryptionKeysKeyState converts a InstanceEncryptionKeysKeyState resource from its proto representation. func ProtoToTier2AlphaInstanceEncryptionKeysKeyState(p *alphapb.Tier2AlphaInstanceEncryptionKeysKeyState) *alpha.InstanceEncryptionKeysKeyState { if p == nil { return nil } obj := &alpha.InstanceEncryptionKeysKeyState{ KeyStateVersion: dcl.Int64OrNil(p.KeyStateVersion), Availability: ProtoToTier2AlphaInstanceEncryptionKeysKeyStateAvailability(p.GetAvailability()), } return obj } // ProtoToInstanceEncryptionKeysKeyStateAvailability converts a InstanceEncryptionKeysKeyStateAvailability resource from its proto representation. func ProtoToTier2AlphaInstanceEncryptionKeysKeyStateAvailability(p *alphapb.Tier2AlphaInstanceEncryptionKeysKeyStateAvailability) *alpha.InstanceEncryptionKeysKeyStateAvailability { if p == nil { return nil } obj := &alpha.InstanceEncryptionKeysKeyStateAvailability{ PermissionDenied: dcl.Bool(p.PermissionDenied), UnknownFailure: dcl.Bool(p.UnknownFailure), KeyVersionState: ProtoToTier2AlphaInstanceEncryptionKeysKeyStateAvailabilityKeyVersionStateEnum(p.GetKeyVersionState()), } return obj } // ProtoToInstancePreprocessCreateRecipe converts a InstancePreprocessCreateRecipe resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessCreateRecipe(p *alphapb.Tier2AlphaInstancePreprocessCreateRecipe) *alpha.InstancePreprocessCreateRecipe { if p == nil { return nil } obj := &alpha.InstancePreprocessCreateRecipe{ HonorCancelRequest: dcl.Bool(p.HonorCancelRequest), IgnoreRecipeAfter: dcl.Int64OrNil(p.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.Float64OrNil(p.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.Bool(p.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.StringOrNil(p.GetReadonlyRecipeStartTime()), DelayToStoreResourcesInClhDbNanos: dcl.Int64OrNil(p.DelayToStoreResourcesInClhDbNanos), } for _, r := range p.GetSteps() { obj.Steps = append(obj.Steps, *ProtoToTier2AlphaInstancePreprocessCreateRecipeSteps(r)) } for _, r := range p.GetResourceNamesStoredInClhWithDelay() { obj.ResourceNamesStoredInClhWithDelay = append(obj.ResourceNamesStoredInClhWithDelay, r) } return obj } // ProtoToInstancePreprocessCreateRecipeSteps converts a InstancePreprocessCreateRecipeSteps resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessCreateRecipeSteps(p *alphapb.Tier2AlphaInstancePreprocessCreateRecipeSteps) *alpha.InstancePreprocessCreateRecipeSteps { if p == nil { return nil } obj := &alpha.InstancePreprocessCreateRecipeSteps{ RelativeTime: dcl.Int64OrNil(p.RelativeTime), SleepDuration: dcl.Int64OrNil(p.SleepDuration), Action: ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsActionEnum(p.GetAction()), Status: ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsStatus(p.GetStatus()), ErrorSpace: dcl.StringOrNil(p.ErrorSpace), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), ResourceMetadataSize: dcl.Int64OrNil(p.ResourceMetadataSize), Description: dcl.StringOrNil(p.Description), UpdatedRepeatOperationDelaySec: dcl.Float64OrNil(p.UpdatedRepeatOperationDelaySec), PreprocessUpdate: ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsPreprocessUpdate(p.GetPreprocessUpdate()), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), RequestedTenantProject: ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsRequestedTenantProject(p.GetRequestedTenantProject()), KeyNotificationsUpdate: ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsKeyNotificationsUpdate(p.GetKeyNotificationsUpdate()), ClhDataUpdateTime: dcl.StringOrNil(p.GetClhDataUpdateTime()), PublicErrorMessage: dcl.StringOrNil(p.PublicErrorMessage), } for _, r := range p.GetQuotaRequestDeltas() { obj.QuotaRequestDeltas = append(obj.QuotaRequestDeltas, *ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsQuotaRequestDeltas(r)) } for _, r := range p.GetPermissionsInfo() { obj.PermissionsInfo = append(obj.PermissionsInfo, *ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfo(r)) } return obj } // ProtoToInstancePreprocessCreateRecipeStepsStatus converts a InstancePreprocessCreateRecipeStepsStatus resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsStatus(p *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsStatus) *alpha.InstancePreprocessCreateRecipeStepsStatus { if p == nil { return nil } obj := &alpha.InstancePreprocessCreateRecipeStepsStatus{ Code: dcl.Int64OrNil(p.Code), Message: dcl.StringOrNil(p.Message), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsStatusDetails(r)) } return obj } // ProtoToInstancePreprocessCreateRecipeStepsStatusDetails converts a InstancePreprocessCreateRecipeStepsStatusDetails resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsStatusDetails(p *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsStatusDetails) *alpha.InstancePreprocessCreateRecipeStepsStatusDetails { if p == nil { return nil } obj := &alpha.InstancePreprocessCreateRecipeStepsStatusDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstancePreprocessCreateRecipeStepsQuotaRequestDeltas converts a InstancePreprocessCreateRecipeStepsQuotaRequestDeltas resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsQuotaRequestDeltas(p *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsQuotaRequestDeltas) *alpha.InstancePreprocessCreateRecipeStepsQuotaRequestDeltas { if p == nil { return nil } obj := &alpha.InstancePreprocessCreateRecipeStepsQuotaRequestDeltas{ MetricName: dcl.StringOrNil(p.MetricName), Amount: dcl.Int64OrNil(p.Amount), QuotaLocationName: dcl.StringOrNil(p.QuotaLocationName), } return obj } // ProtoToInstancePreprocessCreateRecipeStepsPreprocessUpdate converts a InstancePreprocessCreateRecipeStepsPreprocessUpdate resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsPreprocessUpdate(p *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsPreprocessUpdate) *alpha.InstancePreprocessCreateRecipeStepsPreprocessUpdate { if p == nil { return nil } obj := &alpha.InstancePreprocessCreateRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.StringOrNil(p.LatencySloBucketName), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), } return obj } // ProtoToInstancePreprocessCreateRecipeStepsRequestedTenantProject converts a InstancePreprocessCreateRecipeStepsRequestedTenantProject resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsRequestedTenantProject(p *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsRequestedTenantProject) *alpha.InstancePreprocessCreateRecipeStepsRequestedTenantProject { if p == nil { return nil } obj := &alpha.InstancePreprocessCreateRecipeStepsRequestedTenantProject{ Tag: dcl.StringOrNil(p.Tag), Folder: dcl.StringOrNil(p.Folder), Scope: ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsRequestedTenantProjectScopeEnum(p.GetScope()), } return obj } // ProtoToInstancePreprocessCreateRecipeStepsPermissionsInfo converts a InstancePreprocessCreateRecipeStepsPermissionsInfo resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfo(p *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfo) *alpha.InstancePreprocessCreateRecipeStepsPermissionsInfo { if p == nil { return nil } obj := &alpha.InstancePreprocessCreateRecipeStepsPermissionsInfo{ PolicyName: ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoPolicyName(p.GetPolicyName()), ResourcePath: dcl.StringOrNil(p.ResourcePath), ApiAttrs: ProtoToTier2AlphaInstanceGoogleprotobufstruct(p.GetApiAttrs()), PolicyNameMode: ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoPolicyNameModeEnum(p.GetPolicyNameMode()), Resource: ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoResource(p.GetResource()), } for _, r := range p.GetIamPermissions() { obj.IamPermissions = append(obj.IamPermissions, *ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoIamPermissions(r)) } return obj } // ProtoToInstancePreprocessCreateRecipeStepsPermissionsInfoPolicyName converts a InstancePreprocessCreateRecipeStepsPermissionsInfoPolicyName resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoPolicyName(p *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoPolicyName) *alpha.InstancePreprocessCreateRecipeStepsPermissionsInfoPolicyName { if p == nil { return nil } obj := &alpha.InstancePreprocessCreateRecipeStepsPermissionsInfoPolicyName{ Type: dcl.StringOrNil(p.Type), Id: dcl.StringOrNil(p.Id), Region: dcl.StringOrNil(p.Region), } return obj } // ProtoToInstancePreprocessCreateRecipeStepsPermissionsInfoIamPermissions converts a InstancePreprocessCreateRecipeStepsPermissionsInfoIamPermissions resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoIamPermissions(p *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoIamPermissions) *alpha.InstancePreprocessCreateRecipeStepsPermissionsInfoIamPermissions { if p == nil { return nil } obj := &alpha.InstancePreprocessCreateRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.StringOrNil(p.Permission), } return obj } // ProtoToInstanceGoogleprotobufstruct converts a InstanceGoogleprotobufstruct resource from its proto representation. func ProtoToTier2AlphaInstanceGoogleprotobufstruct(p *alphapb.Tier2AlphaInstanceGoogleprotobufstruct) *alpha.InstanceGoogleprotobufstruct { if p == nil { return nil } obj := &alpha.InstanceGoogleprotobufstruct{} return obj } // ProtoToInstancePreprocessCreateRecipeStepsPermissionsInfoResource converts a InstancePreprocessCreateRecipeStepsPermissionsInfoResource resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoResource(p *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoResource) *alpha.InstancePreprocessCreateRecipeStepsPermissionsInfoResource { if p == nil { return nil } obj := &alpha.InstancePreprocessCreateRecipeStepsPermissionsInfoResource{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), Service: dcl.StringOrNil(p.Service), } return obj } // ProtoToInstancePreprocessCreateRecipeStepsKeyNotificationsUpdate converts a InstancePreprocessCreateRecipeStepsKeyNotificationsUpdate resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsKeyNotificationsUpdate(p *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsKeyNotificationsUpdate) *alpha.InstancePreprocessCreateRecipeStepsKeyNotificationsUpdate { if p == nil { return nil } obj := &alpha.InstancePreprocessCreateRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p.GetKeyNotificationsInfo()), } return obj } // ProtoToInstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo converts a InstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alpha.InstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if p == nil { return nil } obj := &alpha.InstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.Int64OrNil(p.DataVersion), Delegate: dcl.StringOrNil(p.Delegate), } for _, r := range p.GetKeyNotificationConfigs() { obj.KeyNotificationConfigs = append(obj.KeyNotificationConfigs, *ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(r)) } return obj } // ProtoToInstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs converts a InstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(p *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alpha.InstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if p == nil { return nil } obj := &alpha.InstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.StringOrNil(p.KeyOrVersionName), Grant: dcl.StringOrNil(p.Grant), DelegatorGaiaId: dcl.Int64OrNil(p.DelegatorGaiaId), } return obj } // ProtoToInstanceCreateRecipe converts a InstanceCreateRecipe resource from its proto representation. func ProtoToTier2AlphaInstanceCreateRecipe(p *alphapb.Tier2AlphaInstanceCreateRecipe) *alpha.InstanceCreateRecipe { if p == nil { return nil } obj := &alpha.InstanceCreateRecipe{ HonorCancelRequest: dcl.Bool(p.HonorCancelRequest), IgnoreRecipeAfter: dcl.Int64OrNil(p.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.Float64OrNil(p.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.Bool(p.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.StringOrNil(p.GetReadonlyRecipeStartTime()), DelayToStoreResourcesInClhDbNanos: dcl.Int64OrNil(p.DelayToStoreResourcesInClhDbNanos), } for _, r := range p.GetSteps() { obj.Steps = append(obj.Steps, *ProtoToTier2AlphaInstanceCreateRecipeSteps(r)) } for _, r := range p.GetResourceNamesStoredInClhWithDelay() { obj.ResourceNamesStoredInClhWithDelay = append(obj.ResourceNamesStoredInClhWithDelay, r) } return obj } // ProtoToInstanceCreateRecipeSteps converts a InstanceCreateRecipeSteps resource from its proto representation. func ProtoToTier2AlphaInstanceCreateRecipeSteps(p *alphapb.Tier2AlphaInstanceCreateRecipeSteps) *alpha.InstanceCreateRecipeSteps { if p == nil { return nil } obj := &alpha.InstanceCreateRecipeSteps{ RelativeTime: dcl.Int64OrNil(p.RelativeTime), SleepDuration: dcl.Int64OrNil(p.SleepDuration), Action: ProtoToTier2AlphaInstanceCreateRecipeStepsActionEnum(p.GetAction()), Status: ProtoToTier2AlphaInstanceCreateRecipeStepsStatus(p.GetStatus()), ErrorSpace: dcl.StringOrNil(p.ErrorSpace), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), ResourceMetadataSize: dcl.Int64OrNil(p.ResourceMetadataSize), Description: dcl.StringOrNil(p.Description), UpdatedRepeatOperationDelaySec: dcl.Float64OrNil(p.UpdatedRepeatOperationDelaySec), PreprocessUpdate: ProtoToTier2AlphaInstanceCreateRecipeStepsPreprocessUpdate(p.GetPreprocessUpdate()), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), RequestedTenantProject: ProtoToTier2AlphaInstanceCreateRecipeStepsRequestedTenantProject(p.GetRequestedTenantProject()), KeyNotificationsUpdate: ProtoToTier2AlphaInstanceCreateRecipeStepsKeyNotificationsUpdate(p.GetKeyNotificationsUpdate()), ClhDataUpdateTime: dcl.StringOrNil(p.GetClhDataUpdateTime()), PublicErrorMessage: dcl.StringOrNil(p.PublicErrorMessage), } for _, r := range p.GetQuotaRequestDeltas() { obj.QuotaRequestDeltas = append(obj.QuotaRequestDeltas, *ProtoToTier2AlphaInstanceCreateRecipeStepsQuotaRequestDeltas(r)) } for _, r := range p.GetPermissionsInfo() { obj.PermissionsInfo = append(obj.PermissionsInfo, *ProtoToTier2AlphaInstanceCreateRecipeStepsPermissionsInfo(r)) } return obj } // ProtoToInstanceCreateRecipeStepsStatus converts a InstanceCreateRecipeStepsStatus resource from its proto representation. func ProtoToTier2AlphaInstanceCreateRecipeStepsStatus(p *alphapb.Tier2AlphaInstanceCreateRecipeStepsStatus) *alpha.InstanceCreateRecipeStepsStatus { if p == nil { return nil } obj := &alpha.InstanceCreateRecipeStepsStatus{ Code: dcl.Int64OrNil(p.Code), Message: dcl.StringOrNil(p.Message), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstanceCreateRecipeStepsStatusDetails(r)) } return obj } // ProtoToInstanceCreateRecipeStepsStatusDetails converts a InstanceCreateRecipeStepsStatusDetails resource from its proto representation. func ProtoToTier2AlphaInstanceCreateRecipeStepsStatusDetails(p *alphapb.Tier2AlphaInstanceCreateRecipeStepsStatusDetails) *alpha.InstanceCreateRecipeStepsStatusDetails { if p == nil { return nil } obj := &alpha.InstanceCreateRecipeStepsStatusDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstanceCreateRecipeStepsQuotaRequestDeltas converts a InstanceCreateRecipeStepsQuotaRequestDeltas resource from its proto representation. func ProtoToTier2AlphaInstanceCreateRecipeStepsQuotaRequestDeltas(p *alphapb.Tier2AlphaInstanceCreateRecipeStepsQuotaRequestDeltas) *alpha.InstanceCreateRecipeStepsQuotaRequestDeltas { if p == nil { return nil } obj := &alpha.InstanceCreateRecipeStepsQuotaRequestDeltas{ MetricName: dcl.StringOrNil(p.MetricName), Amount: dcl.Int64OrNil(p.Amount), QuotaLocationName: dcl.StringOrNil(p.QuotaLocationName), } return obj } // ProtoToInstanceCreateRecipeStepsPreprocessUpdate converts a InstanceCreateRecipeStepsPreprocessUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceCreateRecipeStepsPreprocessUpdate(p *alphapb.Tier2AlphaInstanceCreateRecipeStepsPreprocessUpdate) *alpha.InstanceCreateRecipeStepsPreprocessUpdate { if p == nil { return nil } obj := &alpha.InstanceCreateRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.StringOrNil(p.LatencySloBucketName), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), } return obj } // ProtoToInstanceCreateRecipeStepsRequestedTenantProject converts a InstanceCreateRecipeStepsRequestedTenantProject resource from its proto representation. func ProtoToTier2AlphaInstanceCreateRecipeStepsRequestedTenantProject(p *alphapb.Tier2AlphaInstanceCreateRecipeStepsRequestedTenantProject) *alpha.InstanceCreateRecipeStepsRequestedTenantProject { if p == nil { return nil } obj := &alpha.InstanceCreateRecipeStepsRequestedTenantProject{ Tag: dcl.StringOrNil(p.Tag), Folder: dcl.StringOrNil(p.Folder), Scope: ProtoToTier2AlphaInstanceCreateRecipeStepsRequestedTenantProjectScopeEnum(p.GetScope()), } return obj } // ProtoToInstanceCreateRecipeStepsPermissionsInfo converts a InstanceCreateRecipeStepsPermissionsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceCreateRecipeStepsPermissionsInfo(p *alphapb.Tier2AlphaInstanceCreateRecipeStepsPermissionsInfo) *alpha.InstanceCreateRecipeStepsPermissionsInfo { if p == nil { return nil } obj := &alpha.InstanceCreateRecipeStepsPermissionsInfo{ PolicyName: ProtoToTier2AlphaInstanceCreateRecipeStepsPermissionsInfoPolicyName(p.GetPolicyName()), ResourcePath: dcl.StringOrNil(p.ResourcePath), ApiAttrs: ProtoToTier2AlphaInstanceGoogleprotobufstruct(p.GetApiAttrs()), PolicyNameMode: ProtoToTier2AlphaInstanceCreateRecipeStepsPermissionsInfoPolicyNameModeEnum(p.GetPolicyNameMode()), Resource: ProtoToTier2AlphaInstanceCreateRecipeStepsPermissionsInfoResource(p.GetResource()), } for _, r := range p.GetIamPermissions() { obj.IamPermissions = append(obj.IamPermissions, *ProtoToTier2AlphaInstanceCreateRecipeStepsPermissionsInfoIamPermissions(r)) } return obj } // ProtoToInstanceCreateRecipeStepsPermissionsInfoPolicyName converts a InstanceCreateRecipeStepsPermissionsInfoPolicyName resource from its proto representation. func ProtoToTier2AlphaInstanceCreateRecipeStepsPermissionsInfoPolicyName(p *alphapb.Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoPolicyName) *alpha.InstanceCreateRecipeStepsPermissionsInfoPolicyName { if p == nil { return nil } obj := &alpha.InstanceCreateRecipeStepsPermissionsInfoPolicyName{ Type: dcl.StringOrNil(p.Type), Id: dcl.StringOrNil(p.Id), Region: dcl.StringOrNil(p.Region), } return obj } // ProtoToInstanceCreateRecipeStepsPermissionsInfoIamPermissions converts a InstanceCreateRecipeStepsPermissionsInfoIamPermissions resource from its proto representation. func ProtoToTier2AlphaInstanceCreateRecipeStepsPermissionsInfoIamPermissions(p *alphapb.Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoIamPermissions) *alpha.InstanceCreateRecipeStepsPermissionsInfoIamPermissions { if p == nil { return nil } obj := &alpha.InstanceCreateRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.StringOrNil(p.Permission), } return obj } // ProtoToInstanceCreateRecipeStepsPermissionsInfoResource converts a InstanceCreateRecipeStepsPermissionsInfoResource resource from its proto representation. func ProtoToTier2AlphaInstanceCreateRecipeStepsPermissionsInfoResource(p *alphapb.Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoResource) *alpha.InstanceCreateRecipeStepsPermissionsInfoResource { if p == nil { return nil } obj := &alpha.InstanceCreateRecipeStepsPermissionsInfoResource{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), Service: dcl.StringOrNil(p.Service), } return obj } // ProtoToInstanceCreateRecipeStepsKeyNotificationsUpdate converts a InstanceCreateRecipeStepsKeyNotificationsUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceCreateRecipeStepsKeyNotificationsUpdate(p *alphapb.Tier2AlphaInstanceCreateRecipeStepsKeyNotificationsUpdate) *alpha.InstanceCreateRecipeStepsKeyNotificationsUpdate { if p == nil { return nil } obj := &alpha.InstanceCreateRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: ProtoToTier2AlphaInstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p.GetKeyNotificationsInfo()), } return obj } // ProtoToInstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo converts a InstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p *alphapb.Tier2AlphaInstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alpha.InstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if p == nil { return nil } obj := &alpha.InstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.Int64OrNil(p.DataVersion), Delegate: dcl.StringOrNil(p.Delegate), } for _, r := range p.GetKeyNotificationConfigs() { obj.KeyNotificationConfigs = append(obj.KeyNotificationConfigs, *ProtoToTier2AlphaInstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(r)) } return obj } // ProtoToInstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs converts a InstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource from its proto representation. func ProtoToTier2AlphaInstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(p *alphapb.Tier2AlphaInstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alpha.InstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if p == nil { return nil } obj := &alpha.InstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.StringOrNil(p.KeyOrVersionName), Grant: dcl.StringOrNil(p.Grant), DelegatorGaiaId: dcl.Int64OrNil(p.DelegatorGaiaId), } return obj } // ProtoToInstanceDeleteRecipe converts a InstanceDeleteRecipe resource from its proto representation. func ProtoToTier2AlphaInstanceDeleteRecipe(p *alphapb.Tier2AlphaInstanceDeleteRecipe) *alpha.InstanceDeleteRecipe { if p == nil { return nil } obj := &alpha.InstanceDeleteRecipe{ HonorCancelRequest: dcl.Bool(p.HonorCancelRequest), IgnoreRecipeAfter: dcl.Int64OrNil(p.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.Float64OrNil(p.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.Bool(p.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.StringOrNil(p.GetReadonlyRecipeStartTime()), DelayToStoreResourcesInClhDbNanos: dcl.Int64OrNil(p.DelayToStoreResourcesInClhDbNanos), } for _, r := range p.GetSteps() { obj.Steps = append(obj.Steps, *ProtoToTier2AlphaInstanceDeleteRecipeSteps(r)) } for _, r := range p.GetResourceNamesStoredInClhWithDelay() { obj.ResourceNamesStoredInClhWithDelay = append(obj.ResourceNamesStoredInClhWithDelay, r) } return obj } // ProtoToInstanceDeleteRecipeSteps converts a InstanceDeleteRecipeSteps resource from its proto representation. func ProtoToTier2AlphaInstanceDeleteRecipeSteps(p *alphapb.Tier2AlphaInstanceDeleteRecipeSteps) *alpha.InstanceDeleteRecipeSteps { if p == nil { return nil } obj := &alpha.InstanceDeleteRecipeSteps{ RelativeTime: dcl.Int64OrNil(p.RelativeTime), SleepDuration: dcl.Int64OrNil(p.SleepDuration), Action: ProtoToTier2AlphaInstanceDeleteRecipeStepsActionEnum(p.GetAction()), Status: ProtoToTier2AlphaInstanceDeleteRecipeStepsStatus(p.GetStatus()), ErrorSpace: dcl.StringOrNil(p.ErrorSpace), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), ResourceMetadataSize: dcl.Int64OrNil(p.ResourceMetadataSize), Description: dcl.StringOrNil(p.Description), UpdatedRepeatOperationDelaySec: dcl.Float64OrNil(p.UpdatedRepeatOperationDelaySec), PreprocessUpdate: ProtoToTier2AlphaInstanceDeleteRecipeStepsPreprocessUpdate(p.GetPreprocessUpdate()), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), RequestedTenantProject: ProtoToTier2AlphaInstanceDeleteRecipeStepsRequestedTenantProject(p.GetRequestedTenantProject()), KeyNotificationsUpdate: ProtoToTier2AlphaInstanceDeleteRecipeStepsKeyNotificationsUpdate(p.GetKeyNotificationsUpdate()), ClhDataUpdateTime: dcl.StringOrNil(p.GetClhDataUpdateTime()), PublicErrorMessage: dcl.StringOrNil(p.PublicErrorMessage), } for _, r := range p.GetQuotaRequestDeltas() { obj.QuotaRequestDeltas = append(obj.QuotaRequestDeltas, *ProtoToTier2AlphaInstanceDeleteRecipeStepsQuotaRequestDeltas(r)) } for _, r := range p.GetPermissionsInfo() { obj.PermissionsInfo = append(obj.PermissionsInfo, *ProtoToTier2AlphaInstanceDeleteRecipeStepsPermissionsInfo(r)) } return obj } // ProtoToInstanceDeleteRecipeStepsStatus converts a InstanceDeleteRecipeStepsStatus resource from its proto representation. func ProtoToTier2AlphaInstanceDeleteRecipeStepsStatus(p *alphapb.Tier2AlphaInstanceDeleteRecipeStepsStatus) *alpha.InstanceDeleteRecipeStepsStatus { if p == nil { return nil } obj := &alpha.InstanceDeleteRecipeStepsStatus{ Code: dcl.Int64OrNil(p.Code), Message: dcl.StringOrNil(p.Message), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstanceDeleteRecipeStepsStatusDetails(r)) } return obj } // ProtoToInstanceDeleteRecipeStepsStatusDetails converts a InstanceDeleteRecipeStepsStatusDetails resource from its proto representation. func ProtoToTier2AlphaInstanceDeleteRecipeStepsStatusDetails(p *alphapb.Tier2AlphaInstanceDeleteRecipeStepsStatusDetails) *alpha.InstanceDeleteRecipeStepsStatusDetails { if p == nil { return nil } obj := &alpha.InstanceDeleteRecipeStepsStatusDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstanceDeleteRecipeStepsQuotaRequestDeltas converts a InstanceDeleteRecipeStepsQuotaRequestDeltas resource from its proto representation. func ProtoToTier2AlphaInstanceDeleteRecipeStepsQuotaRequestDeltas(p *alphapb.Tier2AlphaInstanceDeleteRecipeStepsQuotaRequestDeltas) *alpha.InstanceDeleteRecipeStepsQuotaRequestDeltas { if p == nil { return nil } obj := &alpha.InstanceDeleteRecipeStepsQuotaRequestDeltas{ MetricName: dcl.StringOrNil(p.MetricName), Amount: dcl.Int64OrNil(p.Amount), QuotaLocationName: dcl.StringOrNil(p.QuotaLocationName), } return obj } // ProtoToInstanceDeleteRecipeStepsPreprocessUpdate converts a InstanceDeleteRecipeStepsPreprocessUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceDeleteRecipeStepsPreprocessUpdate(p *alphapb.Tier2AlphaInstanceDeleteRecipeStepsPreprocessUpdate) *alpha.InstanceDeleteRecipeStepsPreprocessUpdate { if p == nil { return nil } obj := &alpha.InstanceDeleteRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.StringOrNil(p.LatencySloBucketName), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), } return obj } // ProtoToInstanceDeleteRecipeStepsRequestedTenantProject converts a InstanceDeleteRecipeStepsRequestedTenantProject resource from its proto representation. func ProtoToTier2AlphaInstanceDeleteRecipeStepsRequestedTenantProject(p *alphapb.Tier2AlphaInstanceDeleteRecipeStepsRequestedTenantProject) *alpha.InstanceDeleteRecipeStepsRequestedTenantProject { if p == nil { return nil } obj := &alpha.InstanceDeleteRecipeStepsRequestedTenantProject{ Tag: dcl.StringOrNil(p.Tag), Folder: dcl.StringOrNil(p.Folder), Scope: ProtoToTier2AlphaInstanceDeleteRecipeStepsRequestedTenantProjectScopeEnum(p.GetScope()), } return obj } // ProtoToInstanceDeleteRecipeStepsPermissionsInfo converts a InstanceDeleteRecipeStepsPermissionsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceDeleteRecipeStepsPermissionsInfo(p *alphapb.Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfo) *alpha.InstanceDeleteRecipeStepsPermissionsInfo { if p == nil { return nil } obj := &alpha.InstanceDeleteRecipeStepsPermissionsInfo{ PolicyName: ProtoToTier2AlphaInstanceDeleteRecipeStepsPermissionsInfoPolicyName(p.GetPolicyName()), ResourcePath: dcl.StringOrNil(p.ResourcePath), ApiAttrs: ProtoToTier2AlphaInstanceGoogleprotobufstruct(p.GetApiAttrs()), PolicyNameMode: ProtoToTier2AlphaInstanceDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum(p.GetPolicyNameMode()), Resource: ProtoToTier2AlphaInstanceDeleteRecipeStepsPermissionsInfoResource(p.GetResource()), } for _, r := range p.GetIamPermissions() { obj.IamPermissions = append(obj.IamPermissions, *ProtoToTier2AlphaInstanceDeleteRecipeStepsPermissionsInfoIamPermissions(r)) } return obj } // ProtoToInstanceDeleteRecipeStepsPermissionsInfoPolicyName converts a InstanceDeleteRecipeStepsPermissionsInfoPolicyName resource from its proto representation. func ProtoToTier2AlphaInstanceDeleteRecipeStepsPermissionsInfoPolicyName(p *alphapb.Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoPolicyName) *alpha.InstanceDeleteRecipeStepsPermissionsInfoPolicyName { if p == nil { return nil } obj := &alpha.InstanceDeleteRecipeStepsPermissionsInfoPolicyName{ Type: dcl.StringOrNil(p.Type), Id: dcl.StringOrNil(p.Id), Region: dcl.StringOrNil(p.Region), } return obj } // ProtoToInstanceDeleteRecipeStepsPermissionsInfoIamPermissions converts a InstanceDeleteRecipeStepsPermissionsInfoIamPermissions resource from its proto representation. func ProtoToTier2AlphaInstanceDeleteRecipeStepsPermissionsInfoIamPermissions(p *alphapb.Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoIamPermissions) *alpha.InstanceDeleteRecipeStepsPermissionsInfoIamPermissions { if p == nil { return nil } obj := &alpha.InstanceDeleteRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.StringOrNil(p.Permission), } return obj } // ProtoToInstanceDeleteRecipeStepsPermissionsInfoResource converts a InstanceDeleteRecipeStepsPermissionsInfoResource resource from its proto representation. func ProtoToTier2AlphaInstanceDeleteRecipeStepsPermissionsInfoResource(p *alphapb.Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoResource) *alpha.InstanceDeleteRecipeStepsPermissionsInfoResource { if p == nil { return nil } obj := &alpha.InstanceDeleteRecipeStepsPermissionsInfoResource{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), Service: dcl.StringOrNil(p.Service), } return obj } // ProtoToInstanceDeleteRecipeStepsKeyNotificationsUpdate converts a InstanceDeleteRecipeStepsKeyNotificationsUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceDeleteRecipeStepsKeyNotificationsUpdate(p *alphapb.Tier2AlphaInstanceDeleteRecipeStepsKeyNotificationsUpdate) *alpha.InstanceDeleteRecipeStepsKeyNotificationsUpdate { if p == nil { return nil } obj := &alpha.InstanceDeleteRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: ProtoToTier2AlphaInstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p.GetKeyNotificationsInfo()), } return obj } // ProtoToInstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo converts a InstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p *alphapb.Tier2AlphaInstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alpha.InstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if p == nil { return nil } obj := &alpha.InstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.Int64OrNil(p.DataVersion), Delegate: dcl.StringOrNil(p.Delegate), } for _, r := range p.GetKeyNotificationConfigs() { obj.KeyNotificationConfigs = append(obj.KeyNotificationConfigs, *ProtoToTier2AlphaInstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(r)) } return obj } // ProtoToInstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs converts a InstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource from its proto representation. func ProtoToTier2AlphaInstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(p *alphapb.Tier2AlphaInstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alpha.InstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if p == nil { return nil } obj := &alpha.InstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.StringOrNil(p.KeyOrVersionName), Grant: dcl.StringOrNil(p.Grant), DelegatorGaiaId: dcl.Int64OrNil(p.DelegatorGaiaId), } return obj } // ProtoToInstanceUpdateRecipe converts a InstanceUpdateRecipe resource from its proto representation. func ProtoToTier2AlphaInstanceUpdateRecipe(p *alphapb.Tier2AlphaInstanceUpdateRecipe) *alpha.InstanceUpdateRecipe { if p == nil { return nil } obj := &alpha.InstanceUpdateRecipe{ HonorCancelRequest: dcl.Bool(p.HonorCancelRequest), IgnoreRecipeAfter: dcl.Int64OrNil(p.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.Float64OrNil(p.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.Bool(p.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.StringOrNil(p.GetReadonlyRecipeStartTime()), DelayToStoreResourcesInClhDbNanos: dcl.Int64OrNil(p.DelayToStoreResourcesInClhDbNanos), } for _, r := range p.GetSteps() { obj.Steps = append(obj.Steps, *ProtoToTier2AlphaInstanceUpdateRecipeSteps(r)) } for _, r := range p.GetResourceNamesStoredInClhWithDelay() { obj.ResourceNamesStoredInClhWithDelay = append(obj.ResourceNamesStoredInClhWithDelay, r) } return obj } // ProtoToInstanceUpdateRecipeSteps converts a InstanceUpdateRecipeSteps resource from its proto representation. func ProtoToTier2AlphaInstanceUpdateRecipeSteps(p *alphapb.Tier2AlphaInstanceUpdateRecipeSteps) *alpha.InstanceUpdateRecipeSteps { if p == nil { return nil } obj := &alpha.InstanceUpdateRecipeSteps{ RelativeTime: dcl.Int64OrNil(p.RelativeTime), SleepDuration: dcl.Int64OrNil(p.SleepDuration), Action: ProtoToTier2AlphaInstanceUpdateRecipeStepsActionEnum(p.GetAction()), Status: ProtoToTier2AlphaInstanceUpdateRecipeStepsStatus(p.GetStatus()), ErrorSpace: dcl.StringOrNil(p.ErrorSpace), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), ResourceMetadataSize: dcl.Int64OrNil(p.ResourceMetadataSize), Description: dcl.StringOrNil(p.Description), UpdatedRepeatOperationDelaySec: dcl.Float64OrNil(p.UpdatedRepeatOperationDelaySec), PreprocessUpdate: ProtoToTier2AlphaInstanceUpdateRecipeStepsPreprocessUpdate(p.GetPreprocessUpdate()), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), RequestedTenantProject: ProtoToTier2AlphaInstanceUpdateRecipeStepsRequestedTenantProject(p.GetRequestedTenantProject()), KeyNotificationsUpdate: ProtoToTier2AlphaInstanceUpdateRecipeStepsKeyNotificationsUpdate(p.GetKeyNotificationsUpdate()), ClhDataUpdateTime: dcl.StringOrNil(p.GetClhDataUpdateTime()), PublicErrorMessage: dcl.StringOrNil(p.PublicErrorMessage), } for _, r := range p.GetQuotaRequestDeltas() { obj.QuotaRequestDeltas = append(obj.QuotaRequestDeltas, *ProtoToTier2AlphaInstanceUpdateRecipeStepsQuotaRequestDeltas(r)) } for _, r := range p.GetPermissionsInfo() { obj.PermissionsInfo = append(obj.PermissionsInfo, *ProtoToTier2AlphaInstanceUpdateRecipeStepsPermissionsInfo(r)) } return obj } // ProtoToInstanceUpdateRecipeStepsStatus converts a InstanceUpdateRecipeStepsStatus resource from its proto representation. func ProtoToTier2AlphaInstanceUpdateRecipeStepsStatus(p *alphapb.Tier2AlphaInstanceUpdateRecipeStepsStatus) *alpha.InstanceUpdateRecipeStepsStatus { if p == nil { return nil } obj := &alpha.InstanceUpdateRecipeStepsStatus{ Code: dcl.Int64OrNil(p.Code), Message: dcl.StringOrNil(p.Message), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstanceUpdateRecipeStepsStatusDetails(r)) } return obj } // ProtoToInstanceUpdateRecipeStepsStatusDetails converts a InstanceUpdateRecipeStepsStatusDetails resource from its proto representation. func ProtoToTier2AlphaInstanceUpdateRecipeStepsStatusDetails(p *alphapb.Tier2AlphaInstanceUpdateRecipeStepsStatusDetails) *alpha.InstanceUpdateRecipeStepsStatusDetails { if p == nil { return nil } obj := &alpha.InstanceUpdateRecipeStepsStatusDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstanceUpdateRecipeStepsQuotaRequestDeltas converts a InstanceUpdateRecipeStepsQuotaRequestDeltas resource from its proto representation. func ProtoToTier2AlphaInstanceUpdateRecipeStepsQuotaRequestDeltas(p *alphapb.Tier2AlphaInstanceUpdateRecipeStepsQuotaRequestDeltas) *alpha.InstanceUpdateRecipeStepsQuotaRequestDeltas { if p == nil { return nil } obj := &alpha.InstanceUpdateRecipeStepsQuotaRequestDeltas{ MetricName: dcl.StringOrNil(p.MetricName), Amount: dcl.Int64OrNil(p.Amount), QuotaLocationName: dcl.StringOrNil(p.QuotaLocationName), } return obj } // ProtoToInstanceUpdateRecipeStepsPreprocessUpdate converts a InstanceUpdateRecipeStepsPreprocessUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceUpdateRecipeStepsPreprocessUpdate(p *alphapb.Tier2AlphaInstanceUpdateRecipeStepsPreprocessUpdate) *alpha.InstanceUpdateRecipeStepsPreprocessUpdate { if p == nil { return nil } obj := &alpha.InstanceUpdateRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.StringOrNil(p.LatencySloBucketName), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), } return obj } // ProtoToInstanceUpdateRecipeStepsRequestedTenantProject converts a InstanceUpdateRecipeStepsRequestedTenantProject resource from its proto representation. func ProtoToTier2AlphaInstanceUpdateRecipeStepsRequestedTenantProject(p *alphapb.Tier2AlphaInstanceUpdateRecipeStepsRequestedTenantProject) *alpha.InstanceUpdateRecipeStepsRequestedTenantProject { if p == nil { return nil } obj := &alpha.InstanceUpdateRecipeStepsRequestedTenantProject{ Tag: dcl.StringOrNil(p.Tag), Folder: dcl.StringOrNil(p.Folder), Scope: ProtoToTier2AlphaInstanceUpdateRecipeStepsRequestedTenantProjectScopeEnum(p.GetScope()), } return obj } // ProtoToInstanceUpdateRecipeStepsPermissionsInfo converts a InstanceUpdateRecipeStepsPermissionsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceUpdateRecipeStepsPermissionsInfo(p *alphapb.Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfo) *alpha.InstanceUpdateRecipeStepsPermissionsInfo { if p == nil { return nil } obj := &alpha.InstanceUpdateRecipeStepsPermissionsInfo{ PolicyName: ProtoToTier2AlphaInstanceUpdateRecipeStepsPermissionsInfoPolicyName(p.GetPolicyName()), ResourcePath: dcl.StringOrNil(p.ResourcePath), ApiAttrs: ProtoToTier2AlphaInstanceGoogleprotobufstruct(p.GetApiAttrs()), PolicyNameMode: ProtoToTier2AlphaInstanceUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum(p.GetPolicyNameMode()), Resource: ProtoToTier2AlphaInstanceUpdateRecipeStepsPermissionsInfoResource(p.GetResource()), } for _, r := range p.GetIamPermissions() { obj.IamPermissions = append(obj.IamPermissions, *ProtoToTier2AlphaInstanceUpdateRecipeStepsPermissionsInfoIamPermissions(r)) } return obj } // ProtoToInstanceUpdateRecipeStepsPermissionsInfoPolicyName converts a InstanceUpdateRecipeStepsPermissionsInfoPolicyName resource from its proto representation. func ProtoToTier2AlphaInstanceUpdateRecipeStepsPermissionsInfoPolicyName(p *alphapb.Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoPolicyName) *alpha.InstanceUpdateRecipeStepsPermissionsInfoPolicyName { if p == nil { return nil } obj := &alpha.InstanceUpdateRecipeStepsPermissionsInfoPolicyName{ Type: dcl.StringOrNil(p.Type), Id: dcl.StringOrNil(p.Id), Region: dcl.StringOrNil(p.Region), } return obj } // ProtoToInstanceUpdateRecipeStepsPermissionsInfoIamPermissions converts a InstanceUpdateRecipeStepsPermissionsInfoIamPermissions resource from its proto representation. func ProtoToTier2AlphaInstanceUpdateRecipeStepsPermissionsInfoIamPermissions(p *alphapb.Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoIamPermissions) *alpha.InstanceUpdateRecipeStepsPermissionsInfoIamPermissions { if p == nil { return nil } obj := &alpha.InstanceUpdateRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.StringOrNil(p.Permission), } return obj } // ProtoToInstanceUpdateRecipeStepsPermissionsInfoResource converts a InstanceUpdateRecipeStepsPermissionsInfoResource resource from its proto representation. func ProtoToTier2AlphaInstanceUpdateRecipeStepsPermissionsInfoResource(p *alphapb.Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoResource) *alpha.InstanceUpdateRecipeStepsPermissionsInfoResource { if p == nil { return nil } obj := &alpha.InstanceUpdateRecipeStepsPermissionsInfoResource{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), Service: dcl.StringOrNil(p.Service), } return obj } // ProtoToInstanceUpdateRecipeStepsKeyNotificationsUpdate converts a InstanceUpdateRecipeStepsKeyNotificationsUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceUpdateRecipeStepsKeyNotificationsUpdate(p *alphapb.Tier2AlphaInstanceUpdateRecipeStepsKeyNotificationsUpdate) *alpha.InstanceUpdateRecipeStepsKeyNotificationsUpdate { if p == nil { return nil } obj := &alpha.InstanceUpdateRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: ProtoToTier2AlphaInstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p.GetKeyNotificationsInfo()), } return obj } // ProtoToInstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo converts a InstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p *alphapb.Tier2AlphaInstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alpha.InstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if p == nil { return nil } obj := &alpha.InstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.Int64OrNil(p.DataVersion), Delegate: dcl.StringOrNil(p.Delegate), } for _, r := range p.GetKeyNotificationConfigs() { obj.KeyNotificationConfigs = append(obj.KeyNotificationConfigs, *ProtoToTier2AlphaInstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(r)) } return obj } // ProtoToInstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs converts a InstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource from its proto representation. func ProtoToTier2AlphaInstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(p *alphapb.Tier2AlphaInstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alpha.InstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if p == nil { return nil } obj := &alpha.InstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.StringOrNil(p.KeyOrVersionName), Grant: dcl.StringOrNil(p.Grant), DelegatorGaiaId: dcl.Int64OrNil(p.DelegatorGaiaId), } return obj } // ProtoToInstancePreprocessResetRecipe converts a InstancePreprocessResetRecipe resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessResetRecipe(p *alphapb.Tier2AlphaInstancePreprocessResetRecipe) *alpha.InstancePreprocessResetRecipe { if p == nil { return nil } obj := &alpha.InstancePreprocessResetRecipe{ HonorCancelRequest: dcl.Bool(p.HonorCancelRequest), IgnoreRecipeAfter: dcl.Int64OrNil(p.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.Float64OrNil(p.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.Bool(p.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.StringOrNil(p.GetReadonlyRecipeStartTime()), DelayToStoreResourcesInClhDbNanos: dcl.Int64OrNil(p.DelayToStoreResourcesInClhDbNanos), } for _, r := range p.GetSteps() { obj.Steps = append(obj.Steps, *ProtoToTier2AlphaInstancePreprocessResetRecipeSteps(r)) } for _, r := range p.GetResourceNamesStoredInClhWithDelay() { obj.ResourceNamesStoredInClhWithDelay = append(obj.ResourceNamesStoredInClhWithDelay, r) } return obj } // ProtoToInstancePreprocessResetRecipeSteps converts a InstancePreprocessResetRecipeSteps resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessResetRecipeSteps(p *alphapb.Tier2AlphaInstancePreprocessResetRecipeSteps) *alpha.InstancePreprocessResetRecipeSteps { if p == nil { return nil } obj := &alpha.InstancePreprocessResetRecipeSteps{ RelativeTime: dcl.Int64OrNil(p.RelativeTime), SleepDuration: dcl.Int64OrNil(p.SleepDuration), Action: ProtoToTier2AlphaInstancePreprocessResetRecipeStepsActionEnum(p.GetAction()), Status: ProtoToTier2AlphaInstancePreprocessResetRecipeStepsStatus(p.GetStatus()), ErrorSpace: dcl.StringOrNil(p.ErrorSpace), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), ResourceMetadataSize: dcl.Int64OrNil(p.ResourceMetadataSize), Description: dcl.StringOrNil(p.Description), UpdatedRepeatOperationDelaySec: dcl.Float64OrNil(p.UpdatedRepeatOperationDelaySec), PreprocessUpdate: ProtoToTier2AlphaInstancePreprocessResetRecipeStepsPreprocessUpdate(p.GetPreprocessUpdate()), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), RequestedTenantProject: ProtoToTier2AlphaInstancePreprocessResetRecipeStepsRequestedTenantProject(p.GetRequestedTenantProject()), KeyNotificationsUpdate: ProtoToTier2AlphaInstancePreprocessResetRecipeStepsKeyNotificationsUpdate(p.GetKeyNotificationsUpdate()), ClhDataUpdateTime: dcl.StringOrNil(p.GetClhDataUpdateTime()), PublicErrorMessage: dcl.StringOrNil(p.PublicErrorMessage), } for _, r := range p.GetQuotaRequestDeltas() { obj.QuotaRequestDeltas = append(obj.QuotaRequestDeltas, *ProtoToTier2AlphaInstancePreprocessResetRecipeStepsQuotaRequestDeltas(r)) } for _, r := range p.GetPermissionsInfo() { obj.PermissionsInfo = append(obj.PermissionsInfo, *ProtoToTier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfo(r)) } return obj } // ProtoToInstancePreprocessResetRecipeStepsStatus converts a InstancePreprocessResetRecipeStepsStatus resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessResetRecipeStepsStatus(p *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsStatus) *alpha.InstancePreprocessResetRecipeStepsStatus { if p == nil { return nil } obj := &alpha.InstancePreprocessResetRecipeStepsStatus{ Code: dcl.Int64OrNil(p.Code), Message: dcl.StringOrNil(p.Message), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstancePreprocessResetRecipeStepsStatusDetails(r)) } return obj } // ProtoToInstancePreprocessResetRecipeStepsStatusDetails converts a InstancePreprocessResetRecipeStepsStatusDetails resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessResetRecipeStepsStatusDetails(p *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsStatusDetails) *alpha.InstancePreprocessResetRecipeStepsStatusDetails { if p == nil { return nil } obj := &alpha.InstancePreprocessResetRecipeStepsStatusDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstancePreprocessResetRecipeStepsQuotaRequestDeltas converts a InstancePreprocessResetRecipeStepsQuotaRequestDeltas resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessResetRecipeStepsQuotaRequestDeltas(p *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsQuotaRequestDeltas) *alpha.InstancePreprocessResetRecipeStepsQuotaRequestDeltas { if p == nil { return nil } obj := &alpha.InstancePreprocessResetRecipeStepsQuotaRequestDeltas{ MetricName: dcl.StringOrNil(p.MetricName), Amount: dcl.Int64OrNil(p.Amount), QuotaLocationName: dcl.StringOrNil(p.QuotaLocationName), } return obj } // ProtoToInstancePreprocessResetRecipeStepsPreprocessUpdate converts a InstancePreprocessResetRecipeStepsPreprocessUpdate resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessResetRecipeStepsPreprocessUpdate(p *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsPreprocessUpdate) *alpha.InstancePreprocessResetRecipeStepsPreprocessUpdate { if p == nil { return nil } obj := &alpha.InstancePreprocessResetRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.StringOrNil(p.LatencySloBucketName), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), } return obj } // ProtoToInstancePreprocessResetRecipeStepsRequestedTenantProject converts a InstancePreprocessResetRecipeStepsRequestedTenantProject resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessResetRecipeStepsRequestedTenantProject(p *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsRequestedTenantProject) *alpha.InstancePreprocessResetRecipeStepsRequestedTenantProject { if p == nil { return nil } obj := &alpha.InstancePreprocessResetRecipeStepsRequestedTenantProject{ Tag: dcl.StringOrNil(p.Tag), Folder: dcl.StringOrNil(p.Folder), Scope: ProtoToTier2AlphaInstancePreprocessResetRecipeStepsRequestedTenantProjectScopeEnum(p.GetScope()), } return obj } // ProtoToInstancePreprocessResetRecipeStepsPermissionsInfo converts a InstancePreprocessResetRecipeStepsPermissionsInfo resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfo(p *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfo) *alpha.InstancePreprocessResetRecipeStepsPermissionsInfo { if p == nil { return nil } obj := &alpha.InstancePreprocessResetRecipeStepsPermissionsInfo{ PolicyName: ProtoToTier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoPolicyName(p.GetPolicyName()), ResourcePath: dcl.StringOrNil(p.ResourcePath), ApiAttrs: ProtoToTier2AlphaInstanceGoogleprotobufstruct(p.GetApiAttrs()), PolicyNameMode: ProtoToTier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoPolicyNameModeEnum(p.GetPolicyNameMode()), Resource: ProtoToTier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoResource(p.GetResource()), } for _, r := range p.GetIamPermissions() { obj.IamPermissions = append(obj.IamPermissions, *ProtoToTier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoIamPermissions(r)) } return obj } // ProtoToInstancePreprocessResetRecipeStepsPermissionsInfoPolicyName converts a InstancePreprocessResetRecipeStepsPermissionsInfoPolicyName resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoPolicyName(p *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoPolicyName) *alpha.InstancePreprocessResetRecipeStepsPermissionsInfoPolicyName { if p == nil { return nil } obj := &alpha.InstancePreprocessResetRecipeStepsPermissionsInfoPolicyName{ Type: dcl.StringOrNil(p.Type), Id: dcl.StringOrNil(p.Id), Region: dcl.StringOrNil(p.Region), } return obj } // ProtoToInstancePreprocessResetRecipeStepsPermissionsInfoIamPermissions converts a InstancePreprocessResetRecipeStepsPermissionsInfoIamPermissions resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoIamPermissions(p *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoIamPermissions) *alpha.InstancePreprocessResetRecipeStepsPermissionsInfoIamPermissions { if p == nil { return nil } obj := &alpha.InstancePreprocessResetRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.StringOrNil(p.Permission), } return obj } // ProtoToInstancePreprocessResetRecipeStepsPermissionsInfoResource converts a InstancePreprocessResetRecipeStepsPermissionsInfoResource resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoResource(p *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoResource) *alpha.InstancePreprocessResetRecipeStepsPermissionsInfoResource { if p == nil { return nil } obj := &alpha.InstancePreprocessResetRecipeStepsPermissionsInfoResource{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), Service: dcl.StringOrNil(p.Service), } return obj } // ProtoToInstancePreprocessResetRecipeStepsKeyNotificationsUpdate converts a InstancePreprocessResetRecipeStepsKeyNotificationsUpdate resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessResetRecipeStepsKeyNotificationsUpdate(p *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsKeyNotificationsUpdate) *alpha.InstancePreprocessResetRecipeStepsKeyNotificationsUpdate { if p == nil { return nil } obj := &alpha.InstancePreprocessResetRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: ProtoToTier2AlphaInstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p.GetKeyNotificationsInfo()), } return obj } // ProtoToInstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo converts a InstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alpha.InstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if p == nil { return nil } obj := &alpha.InstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.Int64OrNil(p.DataVersion), Delegate: dcl.StringOrNil(p.Delegate), } for _, r := range p.GetKeyNotificationConfigs() { obj.KeyNotificationConfigs = append(obj.KeyNotificationConfigs, *ProtoToTier2AlphaInstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(r)) } return obj } // ProtoToInstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs converts a InstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(p *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alpha.InstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if p == nil { return nil } obj := &alpha.InstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.StringOrNil(p.KeyOrVersionName), Grant: dcl.StringOrNil(p.Grant), DelegatorGaiaId: dcl.Int64OrNil(p.DelegatorGaiaId), } return obj } // ProtoToInstanceResetRecipe converts a InstanceResetRecipe resource from its proto representation. func ProtoToTier2AlphaInstanceResetRecipe(p *alphapb.Tier2AlphaInstanceResetRecipe) *alpha.InstanceResetRecipe { if p == nil { return nil } obj := &alpha.InstanceResetRecipe{ HonorCancelRequest: dcl.Bool(p.HonorCancelRequest), IgnoreRecipeAfter: dcl.Int64OrNil(p.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.Float64OrNil(p.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.Bool(p.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.StringOrNil(p.GetReadonlyRecipeStartTime()), DelayToStoreResourcesInClhDbNanos: dcl.Int64OrNil(p.DelayToStoreResourcesInClhDbNanos), } for _, r := range p.GetSteps() { obj.Steps = append(obj.Steps, *ProtoToTier2AlphaInstanceResetRecipeSteps(r)) } for _, r := range p.GetResourceNamesStoredInClhWithDelay() { obj.ResourceNamesStoredInClhWithDelay = append(obj.ResourceNamesStoredInClhWithDelay, r) } return obj } // ProtoToInstanceResetRecipeSteps converts a InstanceResetRecipeSteps resource from its proto representation. func ProtoToTier2AlphaInstanceResetRecipeSteps(p *alphapb.Tier2AlphaInstanceResetRecipeSteps) *alpha.InstanceResetRecipeSteps { if p == nil { return nil } obj := &alpha.InstanceResetRecipeSteps{ RelativeTime: dcl.Int64OrNil(p.RelativeTime), SleepDuration: dcl.Int64OrNil(p.SleepDuration), Action: ProtoToTier2AlphaInstanceResetRecipeStepsActionEnum(p.GetAction()), Status: ProtoToTier2AlphaInstanceResetRecipeStepsStatus(p.GetStatus()), ErrorSpace: dcl.StringOrNil(p.ErrorSpace), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), ResourceMetadataSize: dcl.Int64OrNil(p.ResourceMetadataSize), Description: dcl.StringOrNil(p.Description), UpdatedRepeatOperationDelaySec: dcl.Float64OrNil(p.UpdatedRepeatOperationDelaySec), PreprocessUpdate: ProtoToTier2AlphaInstanceResetRecipeStepsPreprocessUpdate(p.GetPreprocessUpdate()), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), RequestedTenantProject: ProtoToTier2AlphaInstanceResetRecipeStepsRequestedTenantProject(p.GetRequestedTenantProject()), KeyNotificationsUpdate: ProtoToTier2AlphaInstanceResetRecipeStepsKeyNotificationsUpdate(p.GetKeyNotificationsUpdate()), ClhDataUpdateTime: dcl.StringOrNil(p.GetClhDataUpdateTime()), PublicErrorMessage: dcl.StringOrNil(p.PublicErrorMessage), } for _, r := range p.GetQuotaRequestDeltas() { obj.QuotaRequestDeltas = append(obj.QuotaRequestDeltas, *ProtoToTier2AlphaInstanceResetRecipeStepsQuotaRequestDeltas(r)) } for _, r := range p.GetPermissionsInfo() { obj.PermissionsInfo = append(obj.PermissionsInfo, *ProtoToTier2AlphaInstanceResetRecipeStepsPermissionsInfo(r)) } return obj } // ProtoToInstanceResetRecipeStepsStatus converts a InstanceResetRecipeStepsStatus resource from its proto representation. func ProtoToTier2AlphaInstanceResetRecipeStepsStatus(p *alphapb.Tier2AlphaInstanceResetRecipeStepsStatus) *alpha.InstanceResetRecipeStepsStatus { if p == nil { return nil } obj := &alpha.InstanceResetRecipeStepsStatus{ Code: dcl.Int64OrNil(p.Code), Message: dcl.StringOrNil(p.Message), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstanceResetRecipeStepsStatusDetails(r)) } return obj } // ProtoToInstanceResetRecipeStepsStatusDetails converts a InstanceResetRecipeStepsStatusDetails resource from its proto representation. func ProtoToTier2AlphaInstanceResetRecipeStepsStatusDetails(p *alphapb.Tier2AlphaInstanceResetRecipeStepsStatusDetails) *alpha.InstanceResetRecipeStepsStatusDetails { if p == nil { return nil } obj := &alpha.InstanceResetRecipeStepsStatusDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstanceResetRecipeStepsQuotaRequestDeltas converts a InstanceResetRecipeStepsQuotaRequestDeltas resource from its proto representation. func ProtoToTier2AlphaInstanceResetRecipeStepsQuotaRequestDeltas(p *alphapb.Tier2AlphaInstanceResetRecipeStepsQuotaRequestDeltas) *alpha.InstanceResetRecipeStepsQuotaRequestDeltas { if p == nil { return nil } obj := &alpha.InstanceResetRecipeStepsQuotaRequestDeltas{ MetricName: dcl.StringOrNil(p.MetricName), Amount: dcl.Int64OrNil(p.Amount), QuotaLocationName: dcl.StringOrNil(p.QuotaLocationName), } return obj } // ProtoToInstanceResetRecipeStepsPreprocessUpdate converts a InstanceResetRecipeStepsPreprocessUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceResetRecipeStepsPreprocessUpdate(p *alphapb.Tier2AlphaInstanceResetRecipeStepsPreprocessUpdate) *alpha.InstanceResetRecipeStepsPreprocessUpdate { if p == nil { return nil } obj := &alpha.InstanceResetRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.StringOrNil(p.LatencySloBucketName), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), } return obj } // ProtoToInstanceResetRecipeStepsRequestedTenantProject converts a InstanceResetRecipeStepsRequestedTenantProject resource from its proto representation. func ProtoToTier2AlphaInstanceResetRecipeStepsRequestedTenantProject(p *alphapb.Tier2AlphaInstanceResetRecipeStepsRequestedTenantProject) *alpha.InstanceResetRecipeStepsRequestedTenantProject { if p == nil { return nil } obj := &alpha.InstanceResetRecipeStepsRequestedTenantProject{ Tag: dcl.StringOrNil(p.Tag), Folder: dcl.StringOrNil(p.Folder), Scope: ProtoToTier2AlphaInstanceResetRecipeStepsRequestedTenantProjectScopeEnum(p.GetScope()), } return obj } // ProtoToInstanceResetRecipeStepsPermissionsInfo converts a InstanceResetRecipeStepsPermissionsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceResetRecipeStepsPermissionsInfo(p *alphapb.Tier2AlphaInstanceResetRecipeStepsPermissionsInfo) *alpha.InstanceResetRecipeStepsPermissionsInfo { if p == nil { return nil } obj := &alpha.InstanceResetRecipeStepsPermissionsInfo{ PolicyName: ProtoToTier2AlphaInstanceResetRecipeStepsPermissionsInfoPolicyName(p.GetPolicyName()), ResourcePath: dcl.StringOrNil(p.ResourcePath), ApiAttrs: ProtoToTier2AlphaInstanceGoogleprotobufstruct(p.GetApiAttrs()), PolicyNameMode: ProtoToTier2AlphaInstanceResetRecipeStepsPermissionsInfoPolicyNameModeEnum(p.GetPolicyNameMode()), Resource: ProtoToTier2AlphaInstanceResetRecipeStepsPermissionsInfoResource(p.GetResource()), } for _, r := range p.GetIamPermissions() { obj.IamPermissions = append(obj.IamPermissions, *ProtoToTier2AlphaInstanceResetRecipeStepsPermissionsInfoIamPermissions(r)) } return obj } // ProtoToInstanceResetRecipeStepsPermissionsInfoPolicyName converts a InstanceResetRecipeStepsPermissionsInfoPolicyName resource from its proto representation. func ProtoToTier2AlphaInstanceResetRecipeStepsPermissionsInfoPolicyName(p *alphapb.Tier2AlphaInstanceResetRecipeStepsPermissionsInfoPolicyName) *alpha.InstanceResetRecipeStepsPermissionsInfoPolicyName { if p == nil { return nil } obj := &alpha.InstanceResetRecipeStepsPermissionsInfoPolicyName{ Type: dcl.StringOrNil(p.Type), Id: dcl.StringOrNil(p.Id), Region: dcl.StringOrNil(p.Region), } return obj } // ProtoToInstanceResetRecipeStepsPermissionsInfoIamPermissions converts a InstanceResetRecipeStepsPermissionsInfoIamPermissions resource from its proto representation. func ProtoToTier2AlphaInstanceResetRecipeStepsPermissionsInfoIamPermissions(p *alphapb.Tier2AlphaInstanceResetRecipeStepsPermissionsInfoIamPermissions) *alpha.InstanceResetRecipeStepsPermissionsInfoIamPermissions { if p == nil { return nil } obj := &alpha.InstanceResetRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.StringOrNil(p.Permission), } return obj } // ProtoToInstanceResetRecipeStepsPermissionsInfoResource converts a InstanceResetRecipeStepsPermissionsInfoResource resource from its proto representation. func ProtoToTier2AlphaInstanceResetRecipeStepsPermissionsInfoResource(p *alphapb.Tier2AlphaInstanceResetRecipeStepsPermissionsInfoResource) *alpha.InstanceResetRecipeStepsPermissionsInfoResource { if p == nil { return nil } obj := &alpha.InstanceResetRecipeStepsPermissionsInfoResource{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), Service: dcl.StringOrNil(p.Service), } return obj } // ProtoToInstanceResetRecipeStepsKeyNotificationsUpdate converts a InstanceResetRecipeStepsKeyNotificationsUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceResetRecipeStepsKeyNotificationsUpdate(p *alphapb.Tier2AlphaInstanceResetRecipeStepsKeyNotificationsUpdate) *alpha.InstanceResetRecipeStepsKeyNotificationsUpdate { if p == nil { return nil } obj := &alpha.InstanceResetRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: ProtoToTier2AlphaInstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p.GetKeyNotificationsInfo()), } return obj } // ProtoToInstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo converts a InstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p *alphapb.Tier2AlphaInstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alpha.InstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if p == nil { return nil } obj := &alpha.InstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.Int64OrNil(p.DataVersion), Delegate: dcl.StringOrNil(p.Delegate), } for _, r := range p.GetKeyNotificationConfigs() { obj.KeyNotificationConfigs = append(obj.KeyNotificationConfigs, *ProtoToTier2AlphaInstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(r)) } return obj } // ProtoToInstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs converts a InstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource from its proto representation. func ProtoToTier2AlphaInstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(p *alphapb.Tier2AlphaInstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alpha.InstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if p == nil { return nil } obj := &alpha.InstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.StringOrNil(p.KeyOrVersionName), Grant: dcl.StringOrNil(p.Grant), DelegatorGaiaId: dcl.Int64OrNil(p.DelegatorGaiaId), } return obj } // ProtoToInstancePreprocessRepairRecipe converts a InstancePreprocessRepairRecipe resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessRepairRecipe(p *alphapb.Tier2AlphaInstancePreprocessRepairRecipe) *alpha.InstancePreprocessRepairRecipe { if p == nil { return nil } obj := &alpha.InstancePreprocessRepairRecipe{ HonorCancelRequest: dcl.Bool(p.HonorCancelRequest), IgnoreRecipeAfter: dcl.Int64OrNil(p.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.Float64OrNil(p.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.Bool(p.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.StringOrNil(p.GetReadonlyRecipeStartTime()), DelayToStoreResourcesInClhDbNanos: dcl.Int64OrNil(p.DelayToStoreResourcesInClhDbNanos), } for _, r := range p.GetSteps() { obj.Steps = append(obj.Steps, *ProtoToTier2AlphaInstancePreprocessRepairRecipeSteps(r)) } for _, r := range p.GetResourceNamesStoredInClhWithDelay() { obj.ResourceNamesStoredInClhWithDelay = append(obj.ResourceNamesStoredInClhWithDelay, r) } return obj } // ProtoToInstancePreprocessRepairRecipeSteps converts a InstancePreprocessRepairRecipeSteps resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessRepairRecipeSteps(p *alphapb.Tier2AlphaInstancePreprocessRepairRecipeSteps) *alpha.InstancePreprocessRepairRecipeSteps { if p == nil { return nil } obj := &alpha.InstancePreprocessRepairRecipeSteps{ RelativeTime: dcl.Int64OrNil(p.RelativeTime), SleepDuration: dcl.Int64OrNil(p.SleepDuration), Action: ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsActionEnum(p.GetAction()), Status: ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsStatus(p.GetStatus()), ErrorSpace: dcl.StringOrNil(p.ErrorSpace), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), ResourceMetadataSize: dcl.Int64OrNil(p.ResourceMetadataSize), Description: dcl.StringOrNil(p.Description), UpdatedRepeatOperationDelaySec: dcl.Float64OrNil(p.UpdatedRepeatOperationDelaySec), PreprocessUpdate: ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsPreprocessUpdate(p.GetPreprocessUpdate()), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), RequestedTenantProject: ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsRequestedTenantProject(p.GetRequestedTenantProject()), KeyNotificationsUpdate: ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsKeyNotificationsUpdate(p.GetKeyNotificationsUpdate()), ClhDataUpdateTime: dcl.StringOrNil(p.GetClhDataUpdateTime()), PublicErrorMessage: dcl.StringOrNil(p.PublicErrorMessage), } for _, r := range p.GetQuotaRequestDeltas() { obj.QuotaRequestDeltas = append(obj.QuotaRequestDeltas, *ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsQuotaRequestDeltas(r)) } for _, r := range p.GetPermissionsInfo() { obj.PermissionsInfo = append(obj.PermissionsInfo, *ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfo(r)) } return obj } // ProtoToInstancePreprocessRepairRecipeStepsStatus converts a InstancePreprocessRepairRecipeStepsStatus resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsStatus(p *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsStatus) *alpha.InstancePreprocessRepairRecipeStepsStatus { if p == nil { return nil } obj := &alpha.InstancePreprocessRepairRecipeStepsStatus{ Code: dcl.Int64OrNil(p.Code), Message: dcl.StringOrNil(p.Message), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsStatusDetails(r)) } return obj } // ProtoToInstancePreprocessRepairRecipeStepsStatusDetails converts a InstancePreprocessRepairRecipeStepsStatusDetails resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsStatusDetails(p *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsStatusDetails) *alpha.InstancePreprocessRepairRecipeStepsStatusDetails { if p == nil { return nil } obj := &alpha.InstancePreprocessRepairRecipeStepsStatusDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstancePreprocessRepairRecipeStepsQuotaRequestDeltas converts a InstancePreprocessRepairRecipeStepsQuotaRequestDeltas resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsQuotaRequestDeltas(p *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsQuotaRequestDeltas) *alpha.InstancePreprocessRepairRecipeStepsQuotaRequestDeltas { if p == nil { return nil } obj := &alpha.InstancePreprocessRepairRecipeStepsQuotaRequestDeltas{ MetricName: dcl.StringOrNil(p.MetricName), Amount: dcl.Int64OrNil(p.Amount), QuotaLocationName: dcl.StringOrNil(p.QuotaLocationName), } return obj } // ProtoToInstancePreprocessRepairRecipeStepsPreprocessUpdate converts a InstancePreprocessRepairRecipeStepsPreprocessUpdate resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsPreprocessUpdate(p *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsPreprocessUpdate) *alpha.InstancePreprocessRepairRecipeStepsPreprocessUpdate { if p == nil { return nil } obj := &alpha.InstancePreprocessRepairRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.StringOrNil(p.LatencySloBucketName), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), } return obj } // ProtoToInstancePreprocessRepairRecipeStepsRequestedTenantProject converts a InstancePreprocessRepairRecipeStepsRequestedTenantProject resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsRequestedTenantProject(p *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsRequestedTenantProject) *alpha.InstancePreprocessRepairRecipeStepsRequestedTenantProject { if p == nil { return nil } obj := &alpha.InstancePreprocessRepairRecipeStepsRequestedTenantProject{ Tag: dcl.StringOrNil(p.Tag), Folder: dcl.StringOrNil(p.Folder), Scope: ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsRequestedTenantProjectScopeEnum(p.GetScope()), } return obj } // ProtoToInstancePreprocessRepairRecipeStepsPermissionsInfo converts a InstancePreprocessRepairRecipeStepsPermissionsInfo resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfo(p *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfo) *alpha.InstancePreprocessRepairRecipeStepsPermissionsInfo { if p == nil { return nil } obj := &alpha.InstancePreprocessRepairRecipeStepsPermissionsInfo{ PolicyName: ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoPolicyName(p.GetPolicyName()), ResourcePath: dcl.StringOrNil(p.ResourcePath), ApiAttrs: ProtoToTier2AlphaInstanceGoogleprotobufstruct(p.GetApiAttrs()), PolicyNameMode: ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoPolicyNameModeEnum(p.GetPolicyNameMode()), Resource: ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoResource(p.GetResource()), } for _, r := range p.GetIamPermissions() { obj.IamPermissions = append(obj.IamPermissions, *ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoIamPermissions(r)) } return obj } // ProtoToInstancePreprocessRepairRecipeStepsPermissionsInfoPolicyName converts a InstancePreprocessRepairRecipeStepsPermissionsInfoPolicyName resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoPolicyName(p *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoPolicyName) *alpha.InstancePreprocessRepairRecipeStepsPermissionsInfoPolicyName { if p == nil { return nil } obj := &alpha.InstancePreprocessRepairRecipeStepsPermissionsInfoPolicyName{ Type: dcl.StringOrNil(p.Type), Id: dcl.StringOrNil(p.Id), Region: dcl.StringOrNil(p.Region), } return obj } // ProtoToInstancePreprocessRepairRecipeStepsPermissionsInfoIamPermissions converts a InstancePreprocessRepairRecipeStepsPermissionsInfoIamPermissions resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoIamPermissions(p *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoIamPermissions) *alpha.InstancePreprocessRepairRecipeStepsPermissionsInfoIamPermissions { if p == nil { return nil } obj := &alpha.InstancePreprocessRepairRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.StringOrNil(p.Permission), } return obj } // ProtoToInstancePreprocessRepairRecipeStepsPermissionsInfoResource converts a InstancePreprocessRepairRecipeStepsPermissionsInfoResource resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoResource(p *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoResource) *alpha.InstancePreprocessRepairRecipeStepsPermissionsInfoResource { if p == nil { return nil } obj := &alpha.InstancePreprocessRepairRecipeStepsPermissionsInfoResource{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), Service: dcl.StringOrNil(p.Service), } return obj } // ProtoToInstancePreprocessRepairRecipeStepsKeyNotificationsUpdate converts a InstancePreprocessRepairRecipeStepsKeyNotificationsUpdate resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsKeyNotificationsUpdate(p *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsKeyNotificationsUpdate) *alpha.InstancePreprocessRepairRecipeStepsKeyNotificationsUpdate { if p == nil { return nil } obj := &alpha.InstancePreprocessRepairRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p.GetKeyNotificationsInfo()), } return obj } // ProtoToInstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo converts a InstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alpha.InstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if p == nil { return nil } obj := &alpha.InstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.Int64OrNil(p.DataVersion), Delegate: dcl.StringOrNil(p.Delegate), } for _, r := range p.GetKeyNotificationConfigs() { obj.KeyNotificationConfigs = append(obj.KeyNotificationConfigs, *ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(r)) } return obj } // ProtoToInstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs converts a InstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(p *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alpha.InstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if p == nil { return nil } obj := &alpha.InstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.StringOrNil(p.KeyOrVersionName), Grant: dcl.StringOrNil(p.Grant), DelegatorGaiaId: dcl.Int64OrNil(p.DelegatorGaiaId), } return obj } // ProtoToInstanceRepairRecipe converts a InstanceRepairRecipe resource from its proto representation. func ProtoToTier2AlphaInstanceRepairRecipe(p *alphapb.Tier2AlphaInstanceRepairRecipe) *alpha.InstanceRepairRecipe { if p == nil { return nil } obj := &alpha.InstanceRepairRecipe{ HonorCancelRequest: dcl.Bool(p.HonorCancelRequest), IgnoreRecipeAfter: dcl.Int64OrNil(p.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.Float64OrNil(p.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.Bool(p.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.StringOrNil(p.GetReadonlyRecipeStartTime()), DelayToStoreResourcesInClhDbNanos: dcl.Int64OrNil(p.DelayToStoreResourcesInClhDbNanos), } for _, r := range p.GetSteps() { obj.Steps = append(obj.Steps, *ProtoToTier2AlphaInstanceRepairRecipeSteps(r)) } for _, r := range p.GetResourceNamesStoredInClhWithDelay() { obj.ResourceNamesStoredInClhWithDelay = append(obj.ResourceNamesStoredInClhWithDelay, r) } return obj } // ProtoToInstanceRepairRecipeSteps converts a InstanceRepairRecipeSteps resource from its proto representation. func ProtoToTier2AlphaInstanceRepairRecipeSteps(p *alphapb.Tier2AlphaInstanceRepairRecipeSteps) *alpha.InstanceRepairRecipeSteps { if p == nil { return nil } obj := &alpha.InstanceRepairRecipeSteps{ RelativeTime: dcl.Int64OrNil(p.RelativeTime), SleepDuration: dcl.Int64OrNil(p.SleepDuration), Action: ProtoToTier2AlphaInstanceRepairRecipeStepsActionEnum(p.GetAction()), Status: ProtoToTier2AlphaInstanceRepairRecipeStepsStatus(p.GetStatus()), ErrorSpace: dcl.StringOrNil(p.ErrorSpace), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), ResourceMetadataSize: dcl.Int64OrNil(p.ResourceMetadataSize), Description: dcl.StringOrNil(p.Description), UpdatedRepeatOperationDelaySec: dcl.Float64OrNil(p.UpdatedRepeatOperationDelaySec), PreprocessUpdate: ProtoToTier2AlphaInstanceRepairRecipeStepsPreprocessUpdate(p.GetPreprocessUpdate()), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), RequestedTenantProject: ProtoToTier2AlphaInstanceRepairRecipeStepsRequestedTenantProject(p.GetRequestedTenantProject()), KeyNotificationsUpdate: ProtoToTier2AlphaInstanceRepairRecipeStepsKeyNotificationsUpdate(p.GetKeyNotificationsUpdate()), ClhDataUpdateTime: dcl.StringOrNil(p.GetClhDataUpdateTime()), PublicErrorMessage: dcl.StringOrNil(p.PublicErrorMessage), } for _, r := range p.GetQuotaRequestDeltas() { obj.QuotaRequestDeltas = append(obj.QuotaRequestDeltas, *ProtoToTier2AlphaInstanceRepairRecipeStepsQuotaRequestDeltas(r)) } for _, r := range p.GetPermissionsInfo() { obj.PermissionsInfo = append(obj.PermissionsInfo, *ProtoToTier2AlphaInstanceRepairRecipeStepsPermissionsInfo(r)) } return obj } // ProtoToInstanceRepairRecipeStepsStatus converts a InstanceRepairRecipeStepsStatus resource from its proto representation. func ProtoToTier2AlphaInstanceRepairRecipeStepsStatus(p *alphapb.Tier2AlphaInstanceRepairRecipeStepsStatus) *alpha.InstanceRepairRecipeStepsStatus { if p == nil { return nil } obj := &alpha.InstanceRepairRecipeStepsStatus{ Code: dcl.Int64OrNil(p.Code), Message: dcl.StringOrNil(p.Message), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstanceRepairRecipeStepsStatusDetails(r)) } return obj } // ProtoToInstanceRepairRecipeStepsStatusDetails converts a InstanceRepairRecipeStepsStatusDetails resource from its proto representation. func ProtoToTier2AlphaInstanceRepairRecipeStepsStatusDetails(p *alphapb.Tier2AlphaInstanceRepairRecipeStepsStatusDetails) *alpha.InstanceRepairRecipeStepsStatusDetails { if p == nil { return nil } obj := &alpha.InstanceRepairRecipeStepsStatusDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstanceRepairRecipeStepsQuotaRequestDeltas converts a InstanceRepairRecipeStepsQuotaRequestDeltas resource from its proto representation. func ProtoToTier2AlphaInstanceRepairRecipeStepsQuotaRequestDeltas(p *alphapb.Tier2AlphaInstanceRepairRecipeStepsQuotaRequestDeltas) *alpha.InstanceRepairRecipeStepsQuotaRequestDeltas { if p == nil { return nil } obj := &alpha.InstanceRepairRecipeStepsQuotaRequestDeltas{ MetricName: dcl.StringOrNil(p.MetricName), Amount: dcl.Int64OrNil(p.Amount), QuotaLocationName: dcl.StringOrNil(p.QuotaLocationName), } return obj } // ProtoToInstanceRepairRecipeStepsPreprocessUpdate converts a InstanceRepairRecipeStepsPreprocessUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceRepairRecipeStepsPreprocessUpdate(p *alphapb.Tier2AlphaInstanceRepairRecipeStepsPreprocessUpdate) *alpha.InstanceRepairRecipeStepsPreprocessUpdate { if p == nil { return nil } obj := &alpha.InstanceRepairRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.StringOrNil(p.LatencySloBucketName), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), } return obj } // ProtoToInstanceRepairRecipeStepsRequestedTenantProject converts a InstanceRepairRecipeStepsRequestedTenantProject resource from its proto representation. func ProtoToTier2AlphaInstanceRepairRecipeStepsRequestedTenantProject(p *alphapb.Tier2AlphaInstanceRepairRecipeStepsRequestedTenantProject) *alpha.InstanceRepairRecipeStepsRequestedTenantProject { if p == nil { return nil } obj := &alpha.InstanceRepairRecipeStepsRequestedTenantProject{ Tag: dcl.StringOrNil(p.Tag), Folder: dcl.StringOrNil(p.Folder), Scope: ProtoToTier2AlphaInstanceRepairRecipeStepsRequestedTenantProjectScopeEnum(p.GetScope()), } return obj } // ProtoToInstanceRepairRecipeStepsPermissionsInfo converts a InstanceRepairRecipeStepsPermissionsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceRepairRecipeStepsPermissionsInfo(p *alphapb.Tier2AlphaInstanceRepairRecipeStepsPermissionsInfo) *alpha.InstanceRepairRecipeStepsPermissionsInfo { if p == nil { return nil } obj := &alpha.InstanceRepairRecipeStepsPermissionsInfo{ PolicyName: ProtoToTier2AlphaInstanceRepairRecipeStepsPermissionsInfoPolicyName(p.GetPolicyName()), ResourcePath: dcl.StringOrNil(p.ResourcePath), ApiAttrs: ProtoToTier2AlphaInstanceGoogleprotobufstruct(p.GetApiAttrs()), PolicyNameMode: ProtoToTier2AlphaInstanceRepairRecipeStepsPermissionsInfoPolicyNameModeEnum(p.GetPolicyNameMode()), Resource: ProtoToTier2AlphaInstanceRepairRecipeStepsPermissionsInfoResource(p.GetResource()), } for _, r := range p.GetIamPermissions() { obj.IamPermissions = append(obj.IamPermissions, *ProtoToTier2AlphaInstanceRepairRecipeStepsPermissionsInfoIamPermissions(r)) } return obj } // ProtoToInstanceRepairRecipeStepsPermissionsInfoPolicyName converts a InstanceRepairRecipeStepsPermissionsInfoPolicyName resource from its proto representation. func ProtoToTier2AlphaInstanceRepairRecipeStepsPermissionsInfoPolicyName(p *alphapb.Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoPolicyName) *alpha.InstanceRepairRecipeStepsPermissionsInfoPolicyName { if p == nil { return nil } obj := &alpha.InstanceRepairRecipeStepsPermissionsInfoPolicyName{ Type: dcl.StringOrNil(p.Type), Id: dcl.StringOrNil(p.Id), Region: dcl.StringOrNil(p.Region), } return obj } // ProtoToInstanceRepairRecipeStepsPermissionsInfoIamPermissions converts a InstanceRepairRecipeStepsPermissionsInfoIamPermissions resource from its proto representation. func ProtoToTier2AlphaInstanceRepairRecipeStepsPermissionsInfoIamPermissions(p *alphapb.Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoIamPermissions) *alpha.InstanceRepairRecipeStepsPermissionsInfoIamPermissions { if p == nil { return nil } obj := &alpha.InstanceRepairRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.StringOrNil(p.Permission), } return obj } // ProtoToInstanceRepairRecipeStepsPermissionsInfoResource converts a InstanceRepairRecipeStepsPermissionsInfoResource resource from its proto representation. func ProtoToTier2AlphaInstanceRepairRecipeStepsPermissionsInfoResource(p *alphapb.Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoResource) *alpha.InstanceRepairRecipeStepsPermissionsInfoResource { if p == nil { return nil } obj := &alpha.InstanceRepairRecipeStepsPermissionsInfoResource{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), Service: dcl.StringOrNil(p.Service), } return obj } // ProtoToInstanceRepairRecipeStepsKeyNotificationsUpdate converts a InstanceRepairRecipeStepsKeyNotificationsUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceRepairRecipeStepsKeyNotificationsUpdate(p *alphapb.Tier2AlphaInstanceRepairRecipeStepsKeyNotificationsUpdate) *alpha.InstanceRepairRecipeStepsKeyNotificationsUpdate { if p == nil { return nil } obj := &alpha.InstanceRepairRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: ProtoToTier2AlphaInstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p.GetKeyNotificationsInfo()), } return obj } // ProtoToInstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo converts a InstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p *alphapb.Tier2AlphaInstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alpha.InstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if p == nil { return nil } obj := &alpha.InstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.Int64OrNil(p.DataVersion), Delegate: dcl.StringOrNil(p.Delegate), } for _, r := range p.GetKeyNotificationConfigs() { obj.KeyNotificationConfigs = append(obj.KeyNotificationConfigs, *ProtoToTier2AlphaInstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(r)) } return obj } // ProtoToInstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs converts a InstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource from its proto representation. func ProtoToTier2AlphaInstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(p *alphapb.Tier2AlphaInstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alpha.InstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if p == nil { return nil } obj := &alpha.InstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.StringOrNil(p.KeyOrVersionName), Grant: dcl.StringOrNil(p.Grant), DelegatorGaiaId: dcl.Int64OrNil(p.DelegatorGaiaId), } return obj } // ProtoToInstancePreprocessDeleteRecipe converts a InstancePreprocessDeleteRecipe resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessDeleteRecipe(p *alphapb.Tier2AlphaInstancePreprocessDeleteRecipe) *alpha.InstancePreprocessDeleteRecipe { if p == nil { return nil } obj := &alpha.InstancePreprocessDeleteRecipe{ HonorCancelRequest: dcl.Bool(p.HonorCancelRequest), IgnoreRecipeAfter: dcl.Int64OrNil(p.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.Float64OrNil(p.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.Bool(p.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.StringOrNil(p.GetReadonlyRecipeStartTime()), DelayToStoreResourcesInClhDbNanos: dcl.Int64OrNil(p.DelayToStoreResourcesInClhDbNanos), } for _, r := range p.GetSteps() { obj.Steps = append(obj.Steps, *ProtoToTier2AlphaInstancePreprocessDeleteRecipeSteps(r)) } for _, r := range p.GetResourceNamesStoredInClhWithDelay() { obj.ResourceNamesStoredInClhWithDelay = append(obj.ResourceNamesStoredInClhWithDelay, r) } return obj } // ProtoToInstancePreprocessDeleteRecipeSteps converts a InstancePreprocessDeleteRecipeSteps resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessDeleteRecipeSteps(p *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeSteps) *alpha.InstancePreprocessDeleteRecipeSteps { if p == nil { return nil } obj := &alpha.InstancePreprocessDeleteRecipeSteps{ RelativeTime: dcl.Int64OrNil(p.RelativeTime), SleepDuration: dcl.Int64OrNil(p.SleepDuration), Action: ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsActionEnum(p.GetAction()), Status: ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsStatus(p.GetStatus()), ErrorSpace: dcl.StringOrNil(p.ErrorSpace), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), ResourceMetadataSize: dcl.Int64OrNil(p.ResourceMetadataSize), Description: dcl.StringOrNil(p.Description), UpdatedRepeatOperationDelaySec: dcl.Float64OrNil(p.UpdatedRepeatOperationDelaySec), PreprocessUpdate: ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsPreprocessUpdate(p.GetPreprocessUpdate()), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), RequestedTenantProject: ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsRequestedTenantProject(p.GetRequestedTenantProject()), KeyNotificationsUpdate: ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdate(p.GetKeyNotificationsUpdate()), ClhDataUpdateTime: dcl.StringOrNil(p.GetClhDataUpdateTime()), PublicErrorMessage: dcl.StringOrNil(p.PublicErrorMessage), } for _, r := range p.GetQuotaRequestDeltas() { obj.QuotaRequestDeltas = append(obj.QuotaRequestDeltas, *ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsQuotaRequestDeltas(r)) } for _, r := range p.GetPermissionsInfo() { obj.PermissionsInfo = append(obj.PermissionsInfo, *ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfo(r)) } return obj } // ProtoToInstancePreprocessDeleteRecipeStepsStatus converts a InstancePreprocessDeleteRecipeStepsStatus resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsStatus(p *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsStatus) *alpha.InstancePreprocessDeleteRecipeStepsStatus { if p == nil { return nil } obj := &alpha.InstancePreprocessDeleteRecipeStepsStatus{ Code: dcl.Int64OrNil(p.Code), Message: dcl.StringOrNil(p.Message), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsStatusDetails(r)) } return obj } // ProtoToInstancePreprocessDeleteRecipeStepsStatusDetails converts a InstancePreprocessDeleteRecipeStepsStatusDetails resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsStatusDetails(p *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsStatusDetails) *alpha.InstancePreprocessDeleteRecipeStepsStatusDetails { if p == nil { return nil } obj := &alpha.InstancePreprocessDeleteRecipeStepsStatusDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstancePreprocessDeleteRecipeStepsQuotaRequestDeltas converts a InstancePreprocessDeleteRecipeStepsQuotaRequestDeltas resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsQuotaRequestDeltas(p *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsQuotaRequestDeltas) *alpha.InstancePreprocessDeleteRecipeStepsQuotaRequestDeltas { if p == nil { return nil } obj := &alpha.InstancePreprocessDeleteRecipeStepsQuotaRequestDeltas{ MetricName: dcl.StringOrNil(p.MetricName), Amount: dcl.Int64OrNil(p.Amount), QuotaLocationName: dcl.StringOrNil(p.QuotaLocationName), } return obj } // ProtoToInstancePreprocessDeleteRecipeStepsPreprocessUpdate converts a InstancePreprocessDeleteRecipeStepsPreprocessUpdate resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsPreprocessUpdate(p *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsPreprocessUpdate) *alpha.InstancePreprocessDeleteRecipeStepsPreprocessUpdate { if p == nil { return nil } obj := &alpha.InstancePreprocessDeleteRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.StringOrNil(p.LatencySloBucketName), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), } return obj } // ProtoToInstancePreprocessDeleteRecipeStepsRequestedTenantProject converts a InstancePreprocessDeleteRecipeStepsRequestedTenantProject resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsRequestedTenantProject(p *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsRequestedTenantProject) *alpha.InstancePreprocessDeleteRecipeStepsRequestedTenantProject { if p == nil { return nil } obj := &alpha.InstancePreprocessDeleteRecipeStepsRequestedTenantProject{ Tag: dcl.StringOrNil(p.Tag), Folder: dcl.StringOrNil(p.Folder), Scope: ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsRequestedTenantProjectScopeEnum(p.GetScope()), } return obj } // ProtoToInstancePreprocessDeleteRecipeStepsPermissionsInfo converts a InstancePreprocessDeleteRecipeStepsPermissionsInfo resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfo(p *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfo) *alpha.InstancePreprocessDeleteRecipeStepsPermissionsInfo { if p == nil { return nil } obj := &alpha.InstancePreprocessDeleteRecipeStepsPermissionsInfo{ PolicyName: ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyName(p.GetPolicyName()), ResourcePath: dcl.StringOrNil(p.ResourcePath), ApiAttrs: ProtoToTier2AlphaInstanceGoogleprotobufstruct(p.GetApiAttrs()), PolicyNameMode: ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum(p.GetPolicyNameMode()), Resource: ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoResource(p.GetResource()), } for _, r := range p.GetIamPermissions() { obj.IamPermissions = append(obj.IamPermissions, *ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoIamPermissions(r)) } return obj } // ProtoToInstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyName converts a InstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyName resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyName(p *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyName) *alpha.InstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyName { if p == nil { return nil } obj := &alpha.InstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyName{ Type: dcl.StringOrNil(p.Type), Id: dcl.StringOrNil(p.Id), Region: dcl.StringOrNil(p.Region), } return obj } // ProtoToInstancePreprocessDeleteRecipeStepsPermissionsInfoIamPermissions converts a InstancePreprocessDeleteRecipeStepsPermissionsInfoIamPermissions resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoIamPermissions(p *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoIamPermissions) *alpha.InstancePreprocessDeleteRecipeStepsPermissionsInfoIamPermissions { if p == nil { return nil } obj := &alpha.InstancePreprocessDeleteRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.StringOrNil(p.Permission), } return obj } // ProtoToInstancePreprocessDeleteRecipeStepsPermissionsInfoResource converts a InstancePreprocessDeleteRecipeStepsPermissionsInfoResource resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoResource(p *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoResource) *alpha.InstancePreprocessDeleteRecipeStepsPermissionsInfoResource { if p == nil { return nil } obj := &alpha.InstancePreprocessDeleteRecipeStepsPermissionsInfoResource{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), Service: dcl.StringOrNil(p.Service), } return obj } // ProtoToInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdate converts a InstancePreprocessDeleteRecipeStepsKeyNotificationsUpdate resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdate(p *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdate) *alpha.InstancePreprocessDeleteRecipeStepsKeyNotificationsUpdate { if p == nil { return nil } obj := &alpha.InstancePreprocessDeleteRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p.GetKeyNotificationsInfo()), } return obj } // ProtoToInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo converts a InstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alpha.InstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if p == nil { return nil } obj := &alpha.InstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.Int64OrNil(p.DataVersion), Delegate: dcl.StringOrNil(p.Delegate), } for _, r := range p.GetKeyNotificationConfigs() { obj.KeyNotificationConfigs = append(obj.KeyNotificationConfigs, *ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(r)) } return obj } // ProtoToInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs converts a InstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(p *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alpha.InstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if p == nil { return nil } obj := &alpha.InstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.StringOrNil(p.KeyOrVersionName), Grant: dcl.StringOrNil(p.Grant), DelegatorGaiaId: dcl.Int64OrNil(p.DelegatorGaiaId), } return obj } // ProtoToInstancePreprocessUpdateRecipe converts a InstancePreprocessUpdateRecipe resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUpdateRecipe(p *alphapb.Tier2AlphaInstancePreprocessUpdateRecipe) *alpha.InstancePreprocessUpdateRecipe { if p == nil { return nil } obj := &alpha.InstancePreprocessUpdateRecipe{ HonorCancelRequest: dcl.Bool(p.HonorCancelRequest), IgnoreRecipeAfter: dcl.Int64OrNil(p.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.Float64OrNil(p.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.Bool(p.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.StringOrNil(p.GetReadonlyRecipeStartTime()), DelayToStoreResourcesInClhDbNanos: dcl.Int64OrNil(p.DelayToStoreResourcesInClhDbNanos), } for _, r := range p.GetSteps() { obj.Steps = append(obj.Steps, *ProtoToTier2AlphaInstancePreprocessUpdateRecipeSteps(r)) } for _, r := range p.GetResourceNamesStoredInClhWithDelay() { obj.ResourceNamesStoredInClhWithDelay = append(obj.ResourceNamesStoredInClhWithDelay, r) } return obj } // ProtoToInstancePreprocessUpdateRecipeSteps converts a InstancePreprocessUpdateRecipeSteps resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUpdateRecipeSteps(p *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeSteps) *alpha.InstancePreprocessUpdateRecipeSteps { if p == nil { return nil } obj := &alpha.InstancePreprocessUpdateRecipeSteps{ RelativeTime: dcl.Int64OrNil(p.RelativeTime), SleepDuration: dcl.Int64OrNil(p.SleepDuration), Action: ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsActionEnum(p.GetAction()), Status: ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsStatus(p.GetStatus()), ErrorSpace: dcl.StringOrNil(p.ErrorSpace), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), ResourceMetadataSize: dcl.Int64OrNil(p.ResourceMetadataSize), Description: dcl.StringOrNil(p.Description), UpdatedRepeatOperationDelaySec: dcl.Float64OrNil(p.UpdatedRepeatOperationDelaySec), PreprocessUpdate: ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsPreprocessUpdate(p.GetPreprocessUpdate()), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), RequestedTenantProject: ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsRequestedTenantProject(p.GetRequestedTenantProject()), KeyNotificationsUpdate: ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdate(p.GetKeyNotificationsUpdate()), ClhDataUpdateTime: dcl.StringOrNil(p.GetClhDataUpdateTime()), PublicErrorMessage: dcl.StringOrNil(p.PublicErrorMessage), } for _, r := range p.GetQuotaRequestDeltas() { obj.QuotaRequestDeltas = append(obj.QuotaRequestDeltas, *ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsQuotaRequestDeltas(r)) } for _, r := range p.GetPermissionsInfo() { obj.PermissionsInfo = append(obj.PermissionsInfo, *ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfo(r)) } return obj } // ProtoToInstancePreprocessUpdateRecipeStepsStatus converts a InstancePreprocessUpdateRecipeStepsStatus resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsStatus(p *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsStatus) *alpha.InstancePreprocessUpdateRecipeStepsStatus { if p == nil { return nil } obj := &alpha.InstancePreprocessUpdateRecipeStepsStatus{ Code: dcl.Int64OrNil(p.Code), Message: dcl.StringOrNil(p.Message), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsStatusDetails(r)) } return obj } // ProtoToInstancePreprocessUpdateRecipeStepsStatusDetails converts a InstancePreprocessUpdateRecipeStepsStatusDetails resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsStatusDetails(p *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsStatusDetails) *alpha.InstancePreprocessUpdateRecipeStepsStatusDetails { if p == nil { return nil } obj := &alpha.InstancePreprocessUpdateRecipeStepsStatusDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstancePreprocessUpdateRecipeStepsQuotaRequestDeltas converts a InstancePreprocessUpdateRecipeStepsQuotaRequestDeltas resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsQuotaRequestDeltas(p *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsQuotaRequestDeltas) *alpha.InstancePreprocessUpdateRecipeStepsQuotaRequestDeltas { if p == nil { return nil } obj := &alpha.InstancePreprocessUpdateRecipeStepsQuotaRequestDeltas{ MetricName: dcl.StringOrNil(p.MetricName), Amount: dcl.Int64OrNil(p.Amount), QuotaLocationName: dcl.StringOrNil(p.QuotaLocationName), } return obj } // ProtoToInstancePreprocessUpdateRecipeStepsPreprocessUpdate converts a InstancePreprocessUpdateRecipeStepsPreprocessUpdate resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsPreprocessUpdate(p *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsPreprocessUpdate) *alpha.InstancePreprocessUpdateRecipeStepsPreprocessUpdate { if p == nil { return nil } obj := &alpha.InstancePreprocessUpdateRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.StringOrNil(p.LatencySloBucketName), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), } return obj } // ProtoToInstancePreprocessUpdateRecipeStepsRequestedTenantProject converts a InstancePreprocessUpdateRecipeStepsRequestedTenantProject resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsRequestedTenantProject(p *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsRequestedTenantProject) *alpha.InstancePreprocessUpdateRecipeStepsRequestedTenantProject { if p == nil { return nil } obj := &alpha.InstancePreprocessUpdateRecipeStepsRequestedTenantProject{ Tag: dcl.StringOrNil(p.Tag), Folder: dcl.StringOrNil(p.Folder), Scope: ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsRequestedTenantProjectScopeEnum(p.GetScope()), } return obj } // ProtoToInstancePreprocessUpdateRecipeStepsPermissionsInfo converts a InstancePreprocessUpdateRecipeStepsPermissionsInfo resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfo(p *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfo) *alpha.InstancePreprocessUpdateRecipeStepsPermissionsInfo { if p == nil { return nil } obj := &alpha.InstancePreprocessUpdateRecipeStepsPermissionsInfo{ PolicyName: ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyName(p.GetPolicyName()), ResourcePath: dcl.StringOrNil(p.ResourcePath), ApiAttrs: ProtoToTier2AlphaInstanceGoogleprotobufstruct(p.GetApiAttrs()), PolicyNameMode: ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum(p.GetPolicyNameMode()), Resource: ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoResource(p.GetResource()), } for _, r := range p.GetIamPermissions() { obj.IamPermissions = append(obj.IamPermissions, *ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoIamPermissions(r)) } return obj } // ProtoToInstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyName converts a InstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyName resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyName(p *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyName) *alpha.InstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyName { if p == nil { return nil } obj := &alpha.InstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyName{ Type: dcl.StringOrNil(p.Type), Id: dcl.StringOrNil(p.Id), Region: dcl.StringOrNil(p.Region), } return obj } // ProtoToInstancePreprocessUpdateRecipeStepsPermissionsInfoIamPermissions converts a InstancePreprocessUpdateRecipeStepsPermissionsInfoIamPermissions resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoIamPermissions(p *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoIamPermissions) *alpha.InstancePreprocessUpdateRecipeStepsPermissionsInfoIamPermissions { if p == nil { return nil } obj := &alpha.InstancePreprocessUpdateRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.StringOrNil(p.Permission), } return obj } // ProtoToInstancePreprocessUpdateRecipeStepsPermissionsInfoResource converts a InstancePreprocessUpdateRecipeStepsPermissionsInfoResource resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoResource(p *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoResource) *alpha.InstancePreprocessUpdateRecipeStepsPermissionsInfoResource { if p == nil { return nil } obj := &alpha.InstancePreprocessUpdateRecipeStepsPermissionsInfoResource{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), Service: dcl.StringOrNil(p.Service), } return obj } // ProtoToInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdate converts a InstancePreprocessUpdateRecipeStepsKeyNotificationsUpdate resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdate(p *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdate) *alpha.InstancePreprocessUpdateRecipeStepsKeyNotificationsUpdate { if p == nil { return nil } obj := &alpha.InstancePreprocessUpdateRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p.GetKeyNotificationsInfo()), } return obj } // ProtoToInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo converts a InstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alpha.InstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if p == nil { return nil } obj := &alpha.InstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.Int64OrNil(p.DataVersion), Delegate: dcl.StringOrNil(p.Delegate), } for _, r := range p.GetKeyNotificationConfigs() { obj.KeyNotificationConfigs = append(obj.KeyNotificationConfigs, *ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(r)) } return obj } // ProtoToInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs converts a InstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(p *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alpha.InstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if p == nil { return nil } obj := &alpha.InstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.StringOrNil(p.KeyOrVersionName), Grant: dcl.StringOrNil(p.Grant), DelegatorGaiaId: dcl.Int64OrNil(p.DelegatorGaiaId), } return obj } // ProtoToInstancePreprocessFreezeRecipe converts a InstancePreprocessFreezeRecipe resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessFreezeRecipe(p *alphapb.Tier2AlphaInstancePreprocessFreezeRecipe) *alpha.InstancePreprocessFreezeRecipe { if p == nil { return nil } obj := &alpha.InstancePreprocessFreezeRecipe{ HonorCancelRequest: dcl.Bool(p.HonorCancelRequest), IgnoreRecipeAfter: dcl.Int64OrNil(p.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.Float64OrNil(p.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.Bool(p.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.StringOrNil(p.GetReadonlyRecipeStartTime()), DelayToStoreResourcesInClhDbNanos: dcl.Int64OrNil(p.DelayToStoreResourcesInClhDbNanos), } for _, r := range p.GetSteps() { obj.Steps = append(obj.Steps, *ProtoToTier2AlphaInstancePreprocessFreezeRecipeSteps(r)) } for _, r := range p.GetResourceNamesStoredInClhWithDelay() { obj.ResourceNamesStoredInClhWithDelay = append(obj.ResourceNamesStoredInClhWithDelay, r) } return obj } // ProtoToInstancePreprocessFreezeRecipeSteps converts a InstancePreprocessFreezeRecipeSteps resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessFreezeRecipeSteps(p *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeSteps) *alpha.InstancePreprocessFreezeRecipeSteps { if p == nil { return nil } obj := &alpha.InstancePreprocessFreezeRecipeSteps{ RelativeTime: dcl.Int64OrNil(p.RelativeTime), SleepDuration: dcl.Int64OrNil(p.SleepDuration), Action: ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsActionEnum(p.GetAction()), Status: ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsStatus(p.GetStatus()), ErrorSpace: dcl.StringOrNil(p.ErrorSpace), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), ResourceMetadataSize: dcl.Int64OrNil(p.ResourceMetadataSize), Description: dcl.StringOrNil(p.Description), UpdatedRepeatOperationDelaySec: dcl.Float64OrNil(p.UpdatedRepeatOperationDelaySec), PreprocessUpdate: ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsPreprocessUpdate(p.GetPreprocessUpdate()), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), RequestedTenantProject: ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsRequestedTenantProject(p.GetRequestedTenantProject()), KeyNotificationsUpdate: ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdate(p.GetKeyNotificationsUpdate()), ClhDataUpdateTime: dcl.StringOrNil(p.GetClhDataUpdateTime()), PublicErrorMessage: dcl.StringOrNil(p.PublicErrorMessage), } for _, r := range p.GetQuotaRequestDeltas() { obj.QuotaRequestDeltas = append(obj.QuotaRequestDeltas, *ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsQuotaRequestDeltas(r)) } for _, r := range p.GetPermissionsInfo() { obj.PermissionsInfo = append(obj.PermissionsInfo, *ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfo(r)) } return obj } // ProtoToInstancePreprocessFreezeRecipeStepsStatus converts a InstancePreprocessFreezeRecipeStepsStatus resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsStatus(p *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsStatus) *alpha.InstancePreprocessFreezeRecipeStepsStatus { if p == nil { return nil } obj := &alpha.InstancePreprocessFreezeRecipeStepsStatus{ Code: dcl.Int64OrNil(p.Code), Message: dcl.StringOrNil(p.Message), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsStatusDetails(r)) } return obj } // ProtoToInstancePreprocessFreezeRecipeStepsStatusDetails converts a InstancePreprocessFreezeRecipeStepsStatusDetails resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsStatusDetails(p *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsStatusDetails) *alpha.InstancePreprocessFreezeRecipeStepsStatusDetails { if p == nil { return nil } obj := &alpha.InstancePreprocessFreezeRecipeStepsStatusDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstancePreprocessFreezeRecipeStepsQuotaRequestDeltas converts a InstancePreprocessFreezeRecipeStepsQuotaRequestDeltas resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsQuotaRequestDeltas(p *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsQuotaRequestDeltas) *alpha.InstancePreprocessFreezeRecipeStepsQuotaRequestDeltas { if p == nil { return nil } obj := &alpha.InstancePreprocessFreezeRecipeStepsQuotaRequestDeltas{ MetricName: dcl.StringOrNil(p.MetricName), Amount: dcl.Int64OrNil(p.Amount), QuotaLocationName: dcl.StringOrNil(p.QuotaLocationName), } return obj } // ProtoToInstancePreprocessFreezeRecipeStepsPreprocessUpdate converts a InstancePreprocessFreezeRecipeStepsPreprocessUpdate resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsPreprocessUpdate(p *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsPreprocessUpdate) *alpha.InstancePreprocessFreezeRecipeStepsPreprocessUpdate { if p == nil { return nil } obj := &alpha.InstancePreprocessFreezeRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.StringOrNil(p.LatencySloBucketName), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), } return obj } // ProtoToInstancePreprocessFreezeRecipeStepsRequestedTenantProject converts a InstancePreprocessFreezeRecipeStepsRequestedTenantProject resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsRequestedTenantProject(p *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsRequestedTenantProject) *alpha.InstancePreprocessFreezeRecipeStepsRequestedTenantProject { if p == nil { return nil } obj := &alpha.InstancePreprocessFreezeRecipeStepsRequestedTenantProject{ Tag: dcl.StringOrNil(p.Tag), Folder: dcl.StringOrNil(p.Folder), Scope: ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsRequestedTenantProjectScopeEnum(p.GetScope()), } return obj } // ProtoToInstancePreprocessFreezeRecipeStepsPermissionsInfo converts a InstancePreprocessFreezeRecipeStepsPermissionsInfo resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfo(p *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfo) *alpha.InstancePreprocessFreezeRecipeStepsPermissionsInfo { if p == nil { return nil } obj := &alpha.InstancePreprocessFreezeRecipeStepsPermissionsInfo{ PolicyName: ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyName(p.GetPolicyName()), ResourcePath: dcl.StringOrNil(p.ResourcePath), ApiAttrs: ProtoToTier2AlphaInstanceGoogleprotobufstruct(p.GetApiAttrs()), PolicyNameMode: ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(p.GetPolicyNameMode()), Resource: ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoResource(p.GetResource()), } for _, r := range p.GetIamPermissions() { obj.IamPermissions = append(obj.IamPermissions, *ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoIamPermissions(r)) } return obj } // ProtoToInstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyName converts a InstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyName resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyName(p *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyName) *alpha.InstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyName { if p == nil { return nil } obj := &alpha.InstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyName{ Type: dcl.StringOrNil(p.Type), Id: dcl.StringOrNil(p.Id), Region: dcl.StringOrNil(p.Region), } return obj } // ProtoToInstancePreprocessFreezeRecipeStepsPermissionsInfoIamPermissions converts a InstancePreprocessFreezeRecipeStepsPermissionsInfoIamPermissions resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoIamPermissions(p *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoIamPermissions) *alpha.InstancePreprocessFreezeRecipeStepsPermissionsInfoIamPermissions { if p == nil { return nil } obj := &alpha.InstancePreprocessFreezeRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.StringOrNil(p.Permission), } return obj } // ProtoToInstancePreprocessFreezeRecipeStepsPermissionsInfoResource converts a InstancePreprocessFreezeRecipeStepsPermissionsInfoResource resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoResource(p *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoResource) *alpha.InstancePreprocessFreezeRecipeStepsPermissionsInfoResource { if p == nil { return nil } obj := &alpha.InstancePreprocessFreezeRecipeStepsPermissionsInfoResource{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), Service: dcl.StringOrNil(p.Service), } return obj } // ProtoToInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdate converts a InstancePreprocessFreezeRecipeStepsKeyNotificationsUpdate resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdate(p *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdate) *alpha.InstancePreprocessFreezeRecipeStepsKeyNotificationsUpdate { if p == nil { return nil } obj := &alpha.InstancePreprocessFreezeRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p.GetKeyNotificationsInfo()), } return obj } // ProtoToInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo converts a InstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alpha.InstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if p == nil { return nil } obj := &alpha.InstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.Int64OrNil(p.DataVersion), Delegate: dcl.StringOrNil(p.Delegate), } for _, r := range p.GetKeyNotificationConfigs() { obj.KeyNotificationConfigs = append(obj.KeyNotificationConfigs, *ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(r)) } return obj } // ProtoToInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs converts a InstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(p *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alpha.InstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if p == nil { return nil } obj := &alpha.InstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.StringOrNil(p.KeyOrVersionName), Grant: dcl.StringOrNil(p.Grant), DelegatorGaiaId: dcl.Int64OrNil(p.DelegatorGaiaId), } return obj } // ProtoToInstanceFreezeRecipe converts a InstanceFreezeRecipe resource from its proto representation. func ProtoToTier2AlphaInstanceFreezeRecipe(p *alphapb.Tier2AlphaInstanceFreezeRecipe) *alpha.InstanceFreezeRecipe { if p == nil { return nil } obj := &alpha.InstanceFreezeRecipe{ HonorCancelRequest: dcl.Bool(p.HonorCancelRequest), IgnoreRecipeAfter: dcl.Int64OrNil(p.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.Float64OrNil(p.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.Bool(p.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.StringOrNil(p.GetReadonlyRecipeStartTime()), DelayToStoreResourcesInClhDbNanos: dcl.Int64OrNil(p.DelayToStoreResourcesInClhDbNanos), } for _, r := range p.GetSteps() { obj.Steps = append(obj.Steps, *ProtoToTier2AlphaInstanceFreezeRecipeSteps(r)) } for _, r := range p.GetResourceNamesStoredInClhWithDelay() { obj.ResourceNamesStoredInClhWithDelay = append(obj.ResourceNamesStoredInClhWithDelay, r) } return obj } // ProtoToInstanceFreezeRecipeSteps converts a InstanceFreezeRecipeSteps resource from its proto representation. func ProtoToTier2AlphaInstanceFreezeRecipeSteps(p *alphapb.Tier2AlphaInstanceFreezeRecipeSteps) *alpha.InstanceFreezeRecipeSteps { if p == nil { return nil } obj := &alpha.InstanceFreezeRecipeSteps{ RelativeTime: dcl.Int64OrNil(p.RelativeTime), SleepDuration: dcl.Int64OrNil(p.SleepDuration), Action: ProtoToTier2AlphaInstanceFreezeRecipeStepsActionEnum(p.GetAction()), Status: ProtoToTier2AlphaInstanceFreezeRecipeStepsStatus(p.GetStatus()), ErrorSpace: dcl.StringOrNil(p.ErrorSpace), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), ResourceMetadataSize: dcl.Int64OrNil(p.ResourceMetadataSize), Description: dcl.StringOrNil(p.Description), UpdatedRepeatOperationDelaySec: dcl.Float64OrNil(p.UpdatedRepeatOperationDelaySec), PreprocessUpdate: ProtoToTier2AlphaInstanceFreezeRecipeStepsPreprocessUpdate(p.GetPreprocessUpdate()), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), RequestedTenantProject: ProtoToTier2AlphaInstanceFreezeRecipeStepsRequestedTenantProject(p.GetRequestedTenantProject()), KeyNotificationsUpdate: ProtoToTier2AlphaInstanceFreezeRecipeStepsKeyNotificationsUpdate(p.GetKeyNotificationsUpdate()), ClhDataUpdateTime: dcl.StringOrNil(p.GetClhDataUpdateTime()), PublicErrorMessage: dcl.StringOrNil(p.PublicErrorMessage), } for _, r := range p.GetQuotaRequestDeltas() { obj.QuotaRequestDeltas = append(obj.QuotaRequestDeltas, *ProtoToTier2AlphaInstanceFreezeRecipeStepsQuotaRequestDeltas(r)) } for _, r := range p.GetPermissionsInfo() { obj.PermissionsInfo = append(obj.PermissionsInfo, *ProtoToTier2AlphaInstanceFreezeRecipeStepsPermissionsInfo(r)) } return obj } // ProtoToInstanceFreezeRecipeStepsStatus converts a InstanceFreezeRecipeStepsStatus resource from its proto representation. func ProtoToTier2AlphaInstanceFreezeRecipeStepsStatus(p *alphapb.Tier2AlphaInstanceFreezeRecipeStepsStatus) *alpha.InstanceFreezeRecipeStepsStatus { if p == nil { return nil } obj := &alpha.InstanceFreezeRecipeStepsStatus{ Code: dcl.Int64OrNil(p.Code), Message: dcl.StringOrNil(p.Message), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstanceFreezeRecipeStepsStatusDetails(r)) } return obj } // ProtoToInstanceFreezeRecipeStepsStatusDetails converts a InstanceFreezeRecipeStepsStatusDetails resource from its proto representation. func ProtoToTier2AlphaInstanceFreezeRecipeStepsStatusDetails(p *alphapb.Tier2AlphaInstanceFreezeRecipeStepsStatusDetails) *alpha.InstanceFreezeRecipeStepsStatusDetails { if p == nil { return nil } obj := &alpha.InstanceFreezeRecipeStepsStatusDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstanceFreezeRecipeStepsQuotaRequestDeltas converts a InstanceFreezeRecipeStepsQuotaRequestDeltas resource from its proto representation. func ProtoToTier2AlphaInstanceFreezeRecipeStepsQuotaRequestDeltas(p *alphapb.Tier2AlphaInstanceFreezeRecipeStepsQuotaRequestDeltas) *alpha.InstanceFreezeRecipeStepsQuotaRequestDeltas { if p == nil { return nil } obj := &alpha.InstanceFreezeRecipeStepsQuotaRequestDeltas{ MetricName: dcl.StringOrNil(p.MetricName), Amount: dcl.Int64OrNil(p.Amount), QuotaLocationName: dcl.StringOrNil(p.QuotaLocationName), } return obj } // ProtoToInstanceFreezeRecipeStepsPreprocessUpdate converts a InstanceFreezeRecipeStepsPreprocessUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceFreezeRecipeStepsPreprocessUpdate(p *alphapb.Tier2AlphaInstanceFreezeRecipeStepsPreprocessUpdate) *alpha.InstanceFreezeRecipeStepsPreprocessUpdate { if p == nil { return nil } obj := &alpha.InstanceFreezeRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.StringOrNil(p.LatencySloBucketName), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), } return obj } // ProtoToInstanceFreezeRecipeStepsRequestedTenantProject converts a InstanceFreezeRecipeStepsRequestedTenantProject resource from its proto representation. func ProtoToTier2AlphaInstanceFreezeRecipeStepsRequestedTenantProject(p *alphapb.Tier2AlphaInstanceFreezeRecipeStepsRequestedTenantProject) *alpha.InstanceFreezeRecipeStepsRequestedTenantProject { if p == nil { return nil } obj := &alpha.InstanceFreezeRecipeStepsRequestedTenantProject{ Tag: dcl.StringOrNil(p.Tag), Folder: dcl.StringOrNil(p.Folder), Scope: ProtoToTier2AlphaInstanceFreezeRecipeStepsRequestedTenantProjectScopeEnum(p.GetScope()), } return obj } // ProtoToInstanceFreezeRecipeStepsPermissionsInfo converts a InstanceFreezeRecipeStepsPermissionsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceFreezeRecipeStepsPermissionsInfo(p *alphapb.Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfo) *alpha.InstanceFreezeRecipeStepsPermissionsInfo { if p == nil { return nil } obj := &alpha.InstanceFreezeRecipeStepsPermissionsInfo{ PolicyName: ProtoToTier2AlphaInstanceFreezeRecipeStepsPermissionsInfoPolicyName(p.GetPolicyName()), ResourcePath: dcl.StringOrNil(p.ResourcePath), ApiAttrs: ProtoToTier2AlphaInstanceGoogleprotobufstruct(p.GetApiAttrs()), PolicyNameMode: ProtoToTier2AlphaInstanceFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(p.GetPolicyNameMode()), Resource: ProtoToTier2AlphaInstanceFreezeRecipeStepsPermissionsInfoResource(p.GetResource()), } for _, r := range p.GetIamPermissions() { obj.IamPermissions = append(obj.IamPermissions, *ProtoToTier2AlphaInstanceFreezeRecipeStepsPermissionsInfoIamPermissions(r)) } return obj } // ProtoToInstanceFreezeRecipeStepsPermissionsInfoPolicyName converts a InstanceFreezeRecipeStepsPermissionsInfoPolicyName resource from its proto representation. func ProtoToTier2AlphaInstanceFreezeRecipeStepsPermissionsInfoPolicyName(p *alphapb.Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoPolicyName) *alpha.InstanceFreezeRecipeStepsPermissionsInfoPolicyName { if p == nil { return nil } obj := &alpha.InstanceFreezeRecipeStepsPermissionsInfoPolicyName{ Type: dcl.StringOrNil(p.Type), Id: dcl.StringOrNil(p.Id), Region: dcl.StringOrNil(p.Region), } return obj } // ProtoToInstanceFreezeRecipeStepsPermissionsInfoIamPermissions converts a InstanceFreezeRecipeStepsPermissionsInfoIamPermissions resource from its proto representation. func ProtoToTier2AlphaInstanceFreezeRecipeStepsPermissionsInfoIamPermissions(p *alphapb.Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoIamPermissions) *alpha.InstanceFreezeRecipeStepsPermissionsInfoIamPermissions { if p == nil { return nil } obj := &alpha.InstanceFreezeRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.StringOrNil(p.Permission), } return obj } // ProtoToInstanceFreezeRecipeStepsPermissionsInfoResource converts a InstanceFreezeRecipeStepsPermissionsInfoResource resource from its proto representation. func ProtoToTier2AlphaInstanceFreezeRecipeStepsPermissionsInfoResource(p *alphapb.Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoResource) *alpha.InstanceFreezeRecipeStepsPermissionsInfoResource { if p == nil { return nil } obj := &alpha.InstanceFreezeRecipeStepsPermissionsInfoResource{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), Service: dcl.StringOrNil(p.Service), } return obj } // ProtoToInstanceFreezeRecipeStepsKeyNotificationsUpdate converts a InstanceFreezeRecipeStepsKeyNotificationsUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceFreezeRecipeStepsKeyNotificationsUpdate(p *alphapb.Tier2AlphaInstanceFreezeRecipeStepsKeyNotificationsUpdate) *alpha.InstanceFreezeRecipeStepsKeyNotificationsUpdate { if p == nil { return nil } obj := &alpha.InstanceFreezeRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: ProtoToTier2AlphaInstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p.GetKeyNotificationsInfo()), } return obj } // ProtoToInstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo converts a InstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p *alphapb.Tier2AlphaInstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alpha.InstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if p == nil { return nil } obj := &alpha.InstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.Int64OrNil(p.DataVersion), Delegate: dcl.StringOrNil(p.Delegate), } for _, r := range p.GetKeyNotificationConfigs() { obj.KeyNotificationConfigs = append(obj.KeyNotificationConfigs, *ProtoToTier2AlphaInstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(r)) } return obj } // ProtoToInstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs converts a InstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource from its proto representation. func ProtoToTier2AlphaInstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(p *alphapb.Tier2AlphaInstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alpha.InstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if p == nil { return nil } obj := &alpha.InstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.StringOrNil(p.KeyOrVersionName), Grant: dcl.StringOrNil(p.Grant), DelegatorGaiaId: dcl.Int64OrNil(p.DelegatorGaiaId), } return obj } // ProtoToInstancePreprocessUnfreezeRecipe converts a InstancePreprocessUnfreezeRecipe resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUnfreezeRecipe(p *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipe) *alpha.InstancePreprocessUnfreezeRecipe { if p == nil { return nil } obj := &alpha.InstancePreprocessUnfreezeRecipe{ HonorCancelRequest: dcl.Bool(p.HonorCancelRequest), IgnoreRecipeAfter: dcl.Int64OrNil(p.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.Float64OrNil(p.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.Bool(p.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.StringOrNil(p.GetReadonlyRecipeStartTime()), DelayToStoreResourcesInClhDbNanos: dcl.Int64OrNil(p.DelayToStoreResourcesInClhDbNanos), } for _, r := range p.GetSteps() { obj.Steps = append(obj.Steps, *ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeSteps(r)) } for _, r := range p.GetResourceNamesStoredInClhWithDelay() { obj.ResourceNamesStoredInClhWithDelay = append(obj.ResourceNamesStoredInClhWithDelay, r) } return obj } // ProtoToInstancePreprocessUnfreezeRecipeSteps converts a InstancePreprocessUnfreezeRecipeSteps resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeSteps(p *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeSteps) *alpha.InstancePreprocessUnfreezeRecipeSteps { if p == nil { return nil } obj := &alpha.InstancePreprocessUnfreezeRecipeSteps{ RelativeTime: dcl.Int64OrNil(p.RelativeTime), SleepDuration: dcl.Int64OrNil(p.SleepDuration), Action: ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsActionEnum(p.GetAction()), Status: ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsStatus(p.GetStatus()), ErrorSpace: dcl.StringOrNil(p.ErrorSpace), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), ResourceMetadataSize: dcl.Int64OrNil(p.ResourceMetadataSize), Description: dcl.StringOrNil(p.Description), UpdatedRepeatOperationDelaySec: dcl.Float64OrNil(p.UpdatedRepeatOperationDelaySec), PreprocessUpdate: ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsPreprocessUpdate(p.GetPreprocessUpdate()), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), RequestedTenantProject: ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsRequestedTenantProject(p.GetRequestedTenantProject()), KeyNotificationsUpdate: ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdate(p.GetKeyNotificationsUpdate()), ClhDataUpdateTime: dcl.StringOrNil(p.GetClhDataUpdateTime()), PublicErrorMessage: dcl.StringOrNil(p.PublicErrorMessage), } for _, r := range p.GetQuotaRequestDeltas() { obj.QuotaRequestDeltas = append(obj.QuotaRequestDeltas, *ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsQuotaRequestDeltas(r)) } for _, r := range p.GetPermissionsInfo() { obj.PermissionsInfo = append(obj.PermissionsInfo, *ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfo(r)) } return obj } // ProtoToInstancePreprocessUnfreezeRecipeStepsStatus converts a InstancePreprocessUnfreezeRecipeStepsStatus resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsStatus(p *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsStatus) *alpha.InstancePreprocessUnfreezeRecipeStepsStatus { if p == nil { return nil } obj := &alpha.InstancePreprocessUnfreezeRecipeStepsStatus{ Code: dcl.Int64OrNil(p.Code), Message: dcl.StringOrNil(p.Message), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsStatusDetails(r)) } return obj } // ProtoToInstancePreprocessUnfreezeRecipeStepsStatusDetails converts a InstancePreprocessUnfreezeRecipeStepsStatusDetails resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsStatusDetails(p *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsStatusDetails) *alpha.InstancePreprocessUnfreezeRecipeStepsStatusDetails { if p == nil { return nil } obj := &alpha.InstancePreprocessUnfreezeRecipeStepsStatusDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstancePreprocessUnfreezeRecipeStepsQuotaRequestDeltas converts a InstancePreprocessUnfreezeRecipeStepsQuotaRequestDeltas resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsQuotaRequestDeltas(p *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsQuotaRequestDeltas) *alpha.InstancePreprocessUnfreezeRecipeStepsQuotaRequestDeltas { if p == nil { return nil } obj := &alpha.InstancePreprocessUnfreezeRecipeStepsQuotaRequestDeltas{ MetricName: dcl.StringOrNil(p.MetricName), Amount: dcl.Int64OrNil(p.Amount), QuotaLocationName: dcl.StringOrNil(p.QuotaLocationName), } return obj } // ProtoToInstancePreprocessUnfreezeRecipeStepsPreprocessUpdate converts a InstancePreprocessUnfreezeRecipeStepsPreprocessUpdate resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsPreprocessUpdate(p *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPreprocessUpdate) *alpha.InstancePreprocessUnfreezeRecipeStepsPreprocessUpdate { if p == nil { return nil } obj := &alpha.InstancePreprocessUnfreezeRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.StringOrNil(p.LatencySloBucketName), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), } return obj } // ProtoToInstancePreprocessUnfreezeRecipeStepsRequestedTenantProject converts a InstancePreprocessUnfreezeRecipeStepsRequestedTenantProject resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsRequestedTenantProject(p *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsRequestedTenantProject) *alpha.InstancePreprocessUnfreezeRecipeStepsRequestedTenantProject { if p == nil { return nil } obj := &alpha.InstancePreprocessUnfreezeRecipeStepsRequestedTenantProject{ Tag: dcl.StringOrNil(p.Tag), Folder: dcl.StringOrNil(p.Folder), Scope: ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsRequestedTenantProjectScopeEnum(p.GetScope()), } return obj } // ProtoToInstancePreprocessUnfreezeRecipeStepsPermissionsInfo converts a InstancePreprocessUnfreezeRecipeStepsPermissionsInfo resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfo(p *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfo) *alpha.InstancePreprocessUnfreezeRecipeStepsPermissionsInfo { if p == nil { return nil } obj := &alpha.InstancePreprocessUnfreezeRecipeStepsPermissionsInfo{ PolicyName: ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyName(p.GetPolicyName()), ResourcePath: dcl.StringOrNil(p.ResourcePath), ApiAttrs: ProtoToTier2AlphaInstanceGoogleprotobufstruct(p.GetApiAttrs()), PolicyNameMode: ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(p.GetPolicyNameMode()), Resource: ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoResource(p.GetResource()), } for _, r := range p.GetIamPermissions() { obj.IamPermissions = append(obj.IamPermissions, *ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoIamPermissions(r)) } return obj } // ProtoToInstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyName converts a InstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyName resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyName(p *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyName) *alpha.InstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyName { if p == nil { return nil } obj := &alpha.InstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyName{ Type: dcl.StringOrNil(p.Type), Id: dcl.StringOrNil(p.Id), Region: dcl.StringOrNil(p.Region), } return obj } // ProtoToInstancePreprocessUnfreezeRecipeStepsPermissionsInfoIamPermissions converts a InstancePreprocessUnfreezeRecipeStepsPermissionsInfoIamPermissions resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoIamPermissions(p *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoIamPermissions) *alpha.InstancePreprocessUnfreezeRecipeStepsPermissionsInfoIamPermissions { if p == nil { return nil } obj := &alpha.InstancePreprocessUnfreezeRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.StringOrNil(p.Permission), } return obj } // ProtoToInstancePreprocessUnfreezeRecipeStepsPermissionsInfoResource converts a InstancePreprocessUnfreezeRecipeStepsPermissionsInfoResource resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoResource(p *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoResource) *alpha.InstancePreprocessUnfreezeRecipeStepsPermissionsInfoResource { if p == nil { return nil } obj := &alpha.InstancePreprocessUnfreezeRecipeStepsPermissionsInfoResource{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), Service: dcl.StringOrNil(p.Service), } return obj } // ProtoToInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdate converts a InstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdate resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdate(p *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdate) *alpha.InstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdate { if p == nil { return nil } obj := &alpha.InstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p.GetKeyNotificationsInfo()), } return obj } // ProtoToInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo converts a InstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alpha.InstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if p == nil { return nil } obj := &alpha.InstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.Int64OrNil(p.DataVersion), Delegate: dcl.StringOrNil(p.Delegate), } for _, r := range p.GetKeyNotificationConfigs() { obj.KeyNotificationConfigs = append(obj.KeyNotificationConfigs, *ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(r)) } return obj } // ProtoToInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs converts a InstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(p *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alpha.InstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if p == nil { return nil } obj := &alpha.InstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.StringOrNil(p.KeyOrVersionName), Grant: dcl.StringOrNil(p.Grant), DelegatorGaiaId: dcl.Int64OrNil(p.DelegatorGaiaId), } return obj } // ProtoToInstanceUnfreezeRecipe converts a InstanceUnfreezeRecipe resource from its proto representation. func ProtoToTier2AlphaInstanceUnfreezeRecipe(p *alphapb.Tier2AlphaInstanceUnfreezeRecipe) *alpha.InstanceUnfreezeRecipe { if p == nil { return nil } obj := &alpha.InstanceUnfreezeRecipe{ HonorCancelRequest: dcl.Bool(p.HonorCancelRequest), IgnoreRecipeAfter: dcl.Int64OrNil(p.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.Float64OrNil(p.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.Bool(p.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.StringOrNil(p.GetReadonlyRecipeStartTime()), DelayToStoreResourcesInClhDbNanos: dcl.Int64OrNil(p.DelayToStoreResourcesInClhDbNanos), } for _, r := range p.GetSteps() { obj.Steps = append(obj.Steps, *ProtoToTier2AlphaInstanceUnfreezeRecipeSteps(r)) } for _, r := range p.GetResourceNamesStoredInClhWithDelay() { obj.ResourceNamesStoredInClhWithDelay = append(obj.ResourceNamesStoredInClhWithDelay, r) } return obj } // ProtoToInstanceUnfreezeRecipeSteps converts a InstanceUnfreezeRecipeSteps resource from its proto representation. func ProtoToTier2AlphaInstanceUnfreezeRecipeSteps(p *alphapb.Tier2AlphaInstanceUnfreezeRecipeSteps) *alpha.InstanceUnfreezeRecipeSteps { if p == nil { return nil } obj := &alpha.InstanceUnfreezeRecipeSteps{ RelativeTime: dcl.Int64OrNil(p.RelativeTime), SleepDuration: dcl.Int64OrNil(p.SleepDuration), Action: ProtoToTier2AlphaInstanceUnfreezeRecipeStepsActionEnum(p.GetAction()), Status: ProtoToTier2AlphaInstanceUnfreezeRecipeStepsStatus(p.GetStatus()), ErrorSpace: dcl.StringOrNil(p.ErrorSpace), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), ResourceMetadataSize: dcl.Int64OrNil(p.ResourceMetadataSize), Description: dcl.StringOrNil(p.Description), UpdatedRepeatOperationDelaySec: dcl.Float64OrNil(p.UpdatedRepeatOperationDelaySec), PreprocessUpdate: ProtoToTier2AlphaInstanceUnfreezeRecipeStepsPreprocessUpdate(p.GetPreprocessUpdate()), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), RequestedTenantProject: ProtoToTier2AlphaInstanceUnfreezeRecipeStepsRequestedTenantProject(p.GetRequestedTenantProject()), KeyNotificationsUpdate: ProtoToTier2AlphaInstanceUnfreezeRecipeStepsKeyNotificationsUpdate(p.GetKeyNotificationsUpdate()), ClhDataUpdateTime: dcl.StringOrNil(p.GetClhDataUpdateTime()), PublicErrorMessage: dcl.StringOrNil(p.PublicErrorMessage), } for _, r := range p.GetQuotaRequestDeltas() { obj.QuotaRequestDeltas = append(obj.QuotaRequestDeltas, *ProtoToTier2AlphaInstanceUnfreezeRecipeStepsQuotaRequestDeltas(r)) } for _, r := range p.GetPermissionsInfo() { obj.PermissionsInfo = append(obj.PermissionsInfo, *ProtoToTier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfo(r)) } return obj } // ProtoToInstanceUnfreezeRecipeStepsStatus converts a InstanceUnfreezeRecipeStepsStatus resource from its proto representation. func ProtoToTier2AlphaInstanceUnfreezeRecipeStepsStatus(p *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsStatus) *alpha.InstanceUnfreezeRecipeStepsStatus { if p == nil { return nil } obj := &alpha.InstanceUnfreezeRecipeStepsStatus{ Code: dcl.Int64OrNil(p.Code), Message: dcl.StringOrNil(p.Message), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstanceUnfreezeRecipeStepsStatusDetails(r)) } return obj } // ProtoToInstanceUnfreezeRecipeStepsStatusDetails converts a InstanceUnfreezeRecipeStepsStatusDetails resource from its proto representation. func ProtoToTier2AlphaInstanceUnfreezeRecipeStepsStatusDetails(p *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsStatusDetails) *alpha.InstanceUnfreezeRecipeStepsStatusDetails { if p == nil { return nil } obj := &alpha.InstanceUnfreezeRecipeStepsStatusDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstanceUnfreezeRecipeStepsQuotaRequestDeltas converts a InstanceUnfreezeRecipeStepsQuotaRequestDeltas resource from its proto representation. func ProtoToTier2AlphaInstanceUnfreezeRecipeStepsQuotaRequestDeltas(p *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsQuotaRequestDeltas) *alpha.InstanceUnfreezeRecipeStepsQuotaRequestDeltas { if p == nil { return nil } obj := &alpha.InstanceUnfreezeRecipeStepsQuotaRequestDeltas{ MetricName: dcl.StringOrNil(p.MetricName), Amount: dcl.Int64OrNil(p.Amount), QuotaLocationName: dcl.StringOrNil(p.QuotaLocationName), } return obj } // ProtoToInstanceUnfreezeRecipeStepsPreprocessUpdate converts a InstanceUnfreezeRecipeStepsPreprocessUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceUnfreezeRecipeStepsPreprocessUpdate(p *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsPreprocessUpdate) *alpha.InstanceUnfreezeRecipeStepsPreprocessUpdate { if p == nil { return nil } obj := &alpha.InstanceUnfreezeRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.StringOrNil(p.LatencySloBucketName), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), } return obj } // ProtoToInstanceUnfreezeRecipeStepsRequestedTenantProject converts a InstanceUnfreezeRecipeStepsRequestedTenantProject resource from its proto representation. func ProtoToTier2AlphaInstanceUnfreezeRecipeStepsRequestedTenantProject(p *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsRequestedTenantProject) *alpha.InstanceUnfreezeRecipeStepsRequestedTenantProject { if p == nil { return nil } obj := &alpha.InstanceUnfreezeRecipeStepsRequestedTenantProject{ Tag: dcl.StringOrNil(p.Tag), Folder: dcl.StringOrNil(p.Folder), Scope: ProtoToTier2AlphaInstanceUnfreezeRecipeStepsRequestedTenantProjectScopeEnum(p.GetScope()), } return obj } // ProtoToInstanceUnfreezeRecipeStepsPermissionsInfo converts a InstanceUnfreezeRecipeStepsPermissionsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfo(p *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfo) *alpha.InstanceUnfreezeRecipeStepsPermissionsInfo { if p == nil { return nil } obj := &alpha.InstanceUnfreezeRecipeStepsPermissionsInfo{ PolicyName: ProtoToTier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoPolicyName(p.GetPolicyName()), ResourcePath: dcl.StringOrNil(p.ResourcePath), ApiAttrs: ProtoToTier2AlphaInstanceGoogleprotobufstruct(p.GetApiAttrs()), PolicyNameMode: ProtoToTier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(p.GetPolicyNameMode()), Resource: ProtoToTier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoResource(p.GetResource()), } for _, r := range p.GetIamPermissions() { obj.IamPermissions = append(obj.IamPermissions, *ProtoToTier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoIamPermissions(r)) } return obj } // ProtoToInstanceUnfreezeRecipeStepsPermissionsInfoPolicyName converts a InstanceUnfreezeRecipeStepsPermissionsInfoPolicyName resource from its proto representation. func ProtoToTier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoPolicyName(p *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoPolicyName) *alpha.InstanceUnfreezeRecipeStepsPermissionsInfoPolicyName { if p == nil { return nil } obj := &alpha.InstanceUnfreezeRecipeStepsPermissionsInfoPolicyName{ Type: dcl.StringOrNil(p.Type), Id: dcl.StringOrNil(p.Id), Region: dcl.StringOrNil(p.Region), } return obj } // ProtoToInstanceUnfreezeRecipeStepsPermissionsInfoIamPermissions converts a InstanceUnfreezeRecipeStepsPermissionsInfoIamPermissions resource from its proto representation. func ProtoToTier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoIamPermissions(p *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoIamPermissions) *alpha.InstanceUnfreezeRecipeStepsPermissionsInfoIamPermissions { if p == nil { return nil } obj := &alpha.InstanceUnfreezeRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.StringOrNil(p.Permission), } return obj } // ProtoToInstanceUnfreezeRecipeStepsPermissionsInfoResource converts a InstanceUnfreezeRecipeStepsPermissionsInfoResource resource from its proto representation. func ProtoToTier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoResource(p *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoResource) *alpha.InstanceUnfreezeRecipeStepsPermissionsInfoResource { if p == nil { return nil } obj := &alpha.InstanceUnfreezeRecipeStepsPermissionsInfoResource{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), Service: dcl.StringOrNil(p.Service), } return obj } // ProtoToInstanceUnfreezeRecipeStepsKeyNotificationsUpdate converts a InstanceUnfreezeRecipeStepsKeyNotificationsUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceUnfreezeRecipeStepsKeyNotificationsUpdate(p *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsKeyNotificationsUpdate) *alpha.InstanceUnfreezeRecipeStepsKeyNotificationsUpdate { if p == nil { return nil } obj := &alpha.InstanceUnfreezeRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: ProtoToTier2AlphaInstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p.GetKeyNotificationsInfo()), } return obj } // ProtoToInstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo converts a InstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alpha.InstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if p == nil { return nil } obj := &alpha.InstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.Int64OrNil(p.DataVersion), Delegate: dcl.StringOrNil(p.Delegate), } for _, r := range p.GetKeyNotificationConfigs() { obj.KeyNotificationConfigs = append(obj.KeyNotificationConfigs, *ProtoToTier2AlphaInstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(r)) } return obj } // ProtoToInstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs converts a InstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource from its proto representation. func ProtoToTier2AlphaInstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(p *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alpha.InstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if p == nil { return nil } obj := &alpha.InstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.StringOrNil(p.KeyOrVersionName), Grant: dcl.StringOrNil(p.Grant), DelegatorGaiaId: dcl.Int64OrNil(p.DelegatorGaiaId), } return obj } // ProtoToInstancePreprocessReportInstanceHealthRecipe converts a InstancePreprocessReportInstanceHealthRecipe resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipe(p *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipe) *alpha.InstancePreprocessReportInstanceHealthRecipe { if p == nil { return nil } obj := &alpha.InstancePreprocessReportInstanceHealthRecipe{ HonorCancelRequest: dcl.Bool(p.HonorCancelRequest), IgnoreRecipeAfter: dcl.Int64OrNil(p.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.Float64OrNil(p.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.Bool(p.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.StringOrNil(p.GetReadonlyRecipeStartTime()), DelayToStoreResourcesInClhDbNanos: dcl.Int64OrNil(p.DelayToStoreResourcesInClhDbNanos), } for _, r := range p.GetSteps() { obj.Steps = append(obj.Steps, *ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeSteps(r)) } for _, r := range p.GetResourceNamesStoredInClhWithDelay() { obj.ResourceNamesStoredInClhWithDelay = append(obj.ResourceNamesStoredInClhWithDelay, r) } return obj } // ProtoToInstancePreprocessReportInstanceHealthRecipeSteps converts a InstancePreprocessReportInstanceHealthRecipeSteps resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeSteps(p *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeSteps) *alpha.InstancePreprocessReportInstanceHealthRecipeSteps { if p == nil { return nil } obj := &alpha.InstancePreprocessReportInstanceHealthRecipeSteps{ RelativeTime: dcl.Int64OrNil(p.RelativeTime), SleepDuration: dcl.Int64OrNil(p.SleepDuration), Action: ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsActionEnum(p.GetAction()), Status: ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsStatus(p.GetStatus()), ErrorSpace: dcl.StringOrNil(p.ErrorSpace), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), ResourceMetadataSize: dcl.Int64OrNil(p.ResourceMetadataSize), Description: dcl.StringOrNil(p.Description), UpdatedRepeatOperationDelaySec: dcl.Float64OrNil(p.UpdatedRepeatOperationDelaySec), PreprocessUpdate: ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPreprocessUpdate(p.GetPreprocessUpdate()), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), RequestedTenantProject: ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProject(p.GetRequestedTenantProject()), KeyNotificationsUpdate: ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdate(p.GetKeyNotificationsUpdate()), ClhDataUpdateTime: dcl.StringOrNil(p.GetClhDataUpdateTime()), PublicErrorMessage: dcl.StringOrNil(p.PublicErrorMessage), } for _, r := range p.GetQuotaRequestDeltas() { obj.QuotaRequestDeltas = append(obj.QuotaRequestDeltas, *ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsQuotaRequestDeltas(r)) } for _, r := range p.GetPermissionsInfo() { obj.PermissionsInfo = append(obj.PermissionsInfo, *ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfo(r)) } return obj } // ProtoToInstancePreprocessReportInstanceHealthRecipeStepsStatus converts a InstancePreprocessReportInstanceHealthRecipeStepsStatus resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsStatus(p *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsStatus) *alpha.InstancePreprocessReportInstanceHealthRecipeStepsStatus { if p == nil { return nil } obj := &alpha.InstancePreprocessReportInstanceHealthRecipeStepsStatus{ Code: dcl.Int64OrNil(p.Code), Message: dcl.StringOrNil(p.Message), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsStatusDetails(r)) } return obj } // ProtoToInstancePreprocessReportInstanceHealthRecipeStepsStatusDetails converts a InstancePreprocessReportInstanceHealthRecipeStepsStatusDetails resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsStatusDetails(p *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsStatusDetails) *alpha.InstancePreprocessReportInstanceHealthRecipeStepsStatusDetails { if p == nil { return nil } obj := &alpha.InstancePreprocessReportInstanceHealthRecipeStepsStatusDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstancePreprocessReportInstanceHealthRecipeStepsQuotaRequestDeltas converts a InstancePreprocessReportInstanceHealthRecipeStepsQuotaRequestDeltas resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsQuotaRequestDeltas(p *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsQuotaRequestDeltas) *alpha.InstancePreprocessReportInstanceHealthRecipeStepsQuotaRequestDeltas { if p == nil { return nil } obj := &alpha.InstancePreprocessReportInstanceHealthRecipeStepsQuotaRequestDeltas{ MetricName: dcl.StringOrNil(p.MetricName), Amount: dcl.Int64OrNil(p.Amount), QuotaLocationName: dcl.StringOrNil(p.QuotaLocationName), } return obj } // ProtoToInstancePreprocessReportInstanceHealthRecipeStepsPreprocessUpdate converts a InstancePreprocessReportInstanceHealthRecipeStepsPreprocessUpdate resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPreprocessUpdate(p *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPreprocessUpdate) *alpha.InstancePreprocessReportInstanceHealthRecipeStepsPreprocessUpdate { if p == nil { return nil } obj := &alpha.InstancePreprocessReportInstanceHealthRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.StringOrNil(p.LatencySloBucketName), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), } return obj } // ProtoToInstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProject converts a InstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProject resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProject(p *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProject) *alpha.InstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProject { if p == nil { return nil } obj := &alpha.InstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProject{ Tag: dcl.StringOrNil(p.Tag), Folder: dcl.StringOrNil(p.Folder), Scope: ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum(p.GetScope()), } return obj } // ProtoToInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfo converts a InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfo resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfo(p *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfo) *alpha.InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfo { if p == nil { return nil } obj := &alpha.InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfo{ PolicyName: ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyName(p.GetPolicyName()), ResourcePath: dcl.StringOrNil(p.ResourcePath), ApiAttrs: ProtoToTier2AlphaInstanceGoogleprotobufstruct(p.GetApiAttrs()), PolicyNameMode: ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum(p.GetPolicyNameMode()), Resource: ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoResource(p.GetResource()), } for _, r := range p.GetIamPermissions() { obj.IamPermissions = append(obj.IamPermissions, *ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoIamPermissions(r)) } return obj } // ProtoToInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyName converts a InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyName resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyName(p *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyName) *alpha.InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyName { if p == nil { return nil } obj := &alpha.InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyName{ Type: dcl.StringOrNil(p.Type), Id: dcl.StringOrNil(p.Id), Region: dcl.StringOrNil(p.Region), } return obj } // ProtoToInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoIamPermissions converts a InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoIamPermissions resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoIamPermissions(p *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoIamPermissions) *alpha.InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoIamPermissions { if p == nil { return nil } obj := &alpha.InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.StringOrNil(p.Permission), } return obj } // ProtoToInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoResource converts a InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoResource resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoResource(p *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoResource) *alpha.InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoResource { if p == nil { return nil } obj := &alpha.InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoResource{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), Service: dcl.StringOrNil(p.Service), } return obj } // ProtoToInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdate converts a InstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdate resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdate(p *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdate) *alpha.InstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdate { if p == nil { return nil } obj := &alpha.InstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p.GetKeyNotificationsInfo()), } return obj } // ProtoToInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo converts a InstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alpha.InstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if p == nil { return nil } obj := &alpha.InstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.Int64OrNil(p.DataVersion), Delegate: dcl.StringOrNil(p.Delegate), } for _, r := range p.GetKeyNotificationConfigs() { obj.KeyNotificationConfigs = append(obj.KeyNotificationConfigs, *ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(r)) } return obj } // ProtoToInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs converts a InstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(p *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alpha.InstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if p == nil { return nil } obj := &alpha.InstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.StringOrNil(p.KeyOrVersionName), Grant: dcl.StringOrNil(p.Grant), DelegatorGaiaId: dcl.Int64OrNil(p.DelegatorGaiaId), } return obj } // ProtoToInstanceReportInstanceHealthRecipe converts a InstanceReportInstanceHealthRecipe resource from its proto representation. func ProtoToTier2AlphaInstanceReportInstanceHealthRecipe(p *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipe) *alpha.InstanceReportInstanceHealthRecipe { if p == nil { return nil } obj := &alpha.InstanceReportInstanceHealthRecipe{ HonorCancelRequest: dcl.Bool(p.HonorCancelRequest), IgnoreRecipeAfter: dcl.Int64OrNil(p.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.Float64OrNil(p.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.Bool(p.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.StringOrNil(p.GetReadonlyRecipeStartTime()), DelayToStoreResourcesInClhDbNanos: dcl.Int64OrNil(p.DelayToStoreResourcesInClhDbNanos), } for _, r := range p.GetSteps() { obj.Steps = append(obj.Steps, *ProtoToTier2AlphaInstanceReportInstanceHealthRecipeSteps(r)) } for _, r := range p.GetResourceNamesStoredInClhWithDelay() { obj.ResourceNamesStoredInClhWithDelay = append(obj.ResourceNamesStoredInClhWithDelay, r) } return obj } // ProtoToInstanceReportInstanceHealthRecipeSteps converts a InstanceReportInstanceHealthRecipeSteps resource from its proto representation. func ProtoToTier2AlphaInstanceReportInstanceHealthRecipeSteps(p *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeSteps) *alpha.InstanceReportInstanceHealthRecipeSteps { if p == nil { return nil } obj := &alpha.InstanceReportInstanceHealthRecipeSteps{ RelativeTime: dcl.Int64OrNil(p.RelativeTime), SleepDuration: dcl.Int64OrNil(p.SleepDuration), Action: ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsActionEnum(p.GetAction()), Status: ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsStatus(p.GetStatus()), ErrorSpace: dcl.StringOrNil(p.ErrorSpace), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), ResourceMetadataSize: dcl.Int64OrNil(p.ResourceMetadataSize), Description: dcl.StringOrNil(p.Description), UpdatedRepeatOperationDelaySec: dcl.Float64OrNil(p.UpdatedRepeatOperationDelaySec), PreprocessUpdate: ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsPreprocessUpdate(p.GetPreprocessUpdate()), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), RequestedTenantProject: ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsRequestedTenantProject(p.GetRequestedTenantProject()), KeyNotificationsUpdate: ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdate(p.GetKeyNotificationsUpdate()), ClhDataUpdateTime: dcl.StringOrNil(p.GetClhDataUpdateTime()), PublicErrorMessage: dcl.StringOrNil(p.PublicErrorMessage), } for _, r := range p.GetQuotaRequestDeltas() { obj.QuotaRequestDeltas = append(obj.QuotaRequestDeltas, *ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsQuotaRequestDeltas(r)) } for _, r := range p.GetPermissionsInfo() { obj.PermissionsInfo = append(obj.PermissionsInfo, *ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfo(r)) } return obj } // ProtoToInstanceReportInstanceHealthRecipeStepsStatus converts a InstanceReportInstanceHealthRecipeStepsStatus resource from its proto representation. func ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsStatus(p *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsStatus) *alpha.InstanceReportInstanceHealthRecipeStepsStatus { if p == nil { return nil } obj := &alpha.InstanceReportInstanceHealthRecipeStepsStatus{ Code: dcl.Int64OrNil(p.Code), Message: dcl.StringOrNil(p.Message), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsStatusDetails(r)) } return obj } // ProtoToInstanceReportInstanceHealthRecipeStepsStatusDetails converts a InstanceReportInstanceHealthRecipeStepsStatusDetails resource from its proto representation. func ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsStatusDetails(p *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsStatusDetails) *alpha.InstanceReportInstanceHealthRecipeStepsStatusDetails { if p == nil { return nil } obj := &alpha.InstanceReportInstanceHealthRecipeStepsStatusDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstanceReportInstanceHealthRecipeStepsQuotaRequestDeltas converts a InstanceReportInstanceHealthRecipeStepsQuotaRequestDeltas resource from its proto representation. func ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsQuotaRequestDeltas(p *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsQuotaRequestDeltas) *alpha.InstanceReportInstanceHealthRecipeStepsQuotaRequestDeltas { if p == nil { return nil } obj := &alpha.InstanceReportInstanceHealthRecipeStepsQuotaRequestDeltas{ MetricName: dcl.StringOrNil(p.MetricName), Amount: dcl.Int64OrNil(p.Amount), QuotaLocationName: dcl.StringOrNil(p.QuotaLocationName), } return obj } // ProtoToInstanceReportInstanceHealthRecipeStepsPreprocessUpdate converts a InstanceReportInstanceHealthRecipeStepsPreprocessUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsPreprocessUpdate(p *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsPreprocessUpdate) *alpha.InstanceReportInstanceHealthRecipeStepsPreprocessUpdate { if p == nil { return nil } obj := &alpha.InstanceReportInstanceHealthRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.StringOrNil(p.LatencySloBucketName), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), } return obj } // ProtoToInstanceReportInstanceHealthRecipeStepsRequestedTenantProject converts a InstanceReportInstanceHealthRecipeStepsRequestedTenantProject resource from its proto representation. func ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsRequestedTenantProject(p *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsRequestedTenantProject) *alpha.InstanceReportInstanceHealthRecipeStepsRequestedTenantProject { if p == nil { return nil } obj := &alpha.InstanceReportInstanceHealthRecipeStepsRequestedTenantProject{ Tag: dcl.StringOrNil(p.Tag), Folder: dcl.StringOrNil(p.Folder), Scope: ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum(p.GetScope()), } return obj } // ProtoToInstanceReportInstanceHealthRecipeStepsPermissionsInfo converts a InstanceReportInstanceHealthRecipeStepsPermissionsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfo(p *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfo) *alpha.InstanceReportInstanceHealthRecipeStepsPermissionsInfo { if p == nil { return nil } obj := &alpha.InstanceReportInstanceHealthRecipeStepsPermissionsInfo{ PolicyName: ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyName(p.GetPolicyName()), ResourcePath: dcl.StringOrNil(p.ResourcePath), ApiAttrs: ProtoToTier2AlphaInstanceGoogleprotobufstruct(p.GetApiAttrs()), PolicyNameMode: ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum(p.GetPolicyNameMode()), Resource: ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoResource(p.GetResource()), } for _, r := range p.GetIamPermissions() { obj.IamPermissions = append(obj.IamPermissions, *ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoIamPermissions(r)) } return obj } // ProtoToInstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyName converts a InstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyName resource from its proto representation. func ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyName(p *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyName) *alpha.InstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyName { if p == nil { return nil } obj := &alpha.InstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyName{ Type: dcl.StringOrNil(p.Type), Id: dcl.StringOrNil(p.Id), Region: dcl.StringOrNil(p.Region), } return obj } // ProtoToInstanceReportInstanceHealthRecipeStepsPermissionsInfoIamPermissions converts a InstanceReportInstanceHealthRecipeStepsPermissionsInfoIamPermissions resource from its proto representation. func ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoIamPermissions(p *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoIamPermissions) *alpha.InstanceReportInstanceHealthRecipeStepsPermissionsInfoIamPermissions { if p == nil { return nil } obj := &alpha.InstanceReportInstanceHealthRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.StringOrNil(p.Permission), } return obj } // ProtoToInstanceReportInstanceHealthRecipeStepsPermissionsInfoResource converts a InstanceReportInstanceHealthRecipeStepsPermissionsInfoResource resource from its proto representation. func ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoResource(p *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoResource) *alpha.InstanceReportInstanceHealthRecipeStepsPermissionsInfoResource { if p == nil { return nil } obj := &alpha.InstanceReportInstanceHealthRecipeStepsPermissionsInfoResource{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), Service: dcl.StringOrNil(p.Service), } return obj } // ProtoToInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdate converts a InstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdate(p *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdate) *alpha.InstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdate { if p == nil { return nil } obj := &alpha.InstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p.GetKeyNotificationsInfo()), } return obj } // ProtoToInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo converts a InstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alpha.InstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if p == nil { return nil } obj := &alpha.InstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.Int64OrNil(p.DataVersion), Delegate: dcl.StringOrNil(p.Delegate), } for _, r := range p.GetKeyNotificationConfigs() { obj.KeyNotificationConfigs = append(obj.KeyNotificationConfigs, *ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(r)) } return obj } // ProtoToInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs converts a InstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource from its proto representation. func ProtoToTier2AlphaInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(p *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alpha.InstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if p == nil { return nil } obj := &alpha.InstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.StringOrNil(p.KeyOrVersionName), Grant: dcl.StringOrNil(p.Grant), DelegatorGaiaId: dcl.Int64OrNil(p.DelegatorGaiaId), } return obj } // ProtoToInstancePreprocessGetRecipe converts a InstancePreprocessGetRecipe resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessGetRecipe(p *alphapb.Tier2AlphaInstancePreprocessGetRecipe) *alpha.InstancePreprocessGetRecipe { if p == nil { return nil } obj := &alpha.InstancePreprocessGetRecipe{ HonorCancelRequest: dcl.Bool(p.HonorCancelRequest), IgnoreRecipeAfter: dcl.Int64OrNil(p.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.Float64OrNil(p.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.Bool(p.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.StringOrNil(p.GetReadonlyRecipeStartTime()), DelayToStoreResourcesInClhDbNanos: dcl.Int64OrNil(p.DelayToStoreResourcesInClhDbNanos), } for _, r := range p.GetSteps() { obj.Steps = append(obj.Steps, *ProtoToTier2AlphaInstancePreprocessGetRecipeSteps(r)) } for _, r := range p.GetResourceNamesStoredInClhWithDelay() { obj.ResourceNamesStoredInClhWithDelay = append(obj.ResourceNamesStoredInClhWithDelay, r) } return obj } // ProtoToInstancePreprocessGetRecipeSteps converts a InstancePreprocessGetRecipeSteps resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessGetRecipeSteps(p *alphapb.Tier2AlphaInstancePreprocessGetRecipeSteps) *alpha.InstancePreprocessGetRecipeSteps { if p == nil { return nil } obj := &alpha.InstancePreprocessGetRecipeSteps{ RelativeTime: dcl.Int64OrNil(p.RelativeTime), SleepDuration: dcl.Int64OrNil(p.SleepDuration), Action: ProtoToTier2AlphaInstancePreprocessGetRecipeStepsActionEnum(p.GetAction()), Status: ProtoToTier2AlphaInstancePreprocessGetRecipeStepsStatus(p.GetStatus()), ErrorSpace: dcl.StringOrNil(p.ErrorSpace), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), ResourceMetadataSize: dcl.Int64OrNil(p.ResourceMetadataSize), Description: dcl.StringOrNil(p.Description), UpdatedRepeatOperationDelaySec: dcl.Float64OrNil(p.UpdatedRepeatOperationDelaySec), PreprocessUpdate: ProtoToTier2AlphaInstancePreprocessGetRecipeStepsPreprocessUpdate(p.GetPreprocessUpdate()), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), RequestedTenantProject: ProtoToTier2AlphaInstancePreprocessGetRecipeStepsRequestedTenantProject(p.GetRequestedTenantProject()), KeyNotificationsUpdate: ProtoToTier2AlphaInstancePreprocessGetRecipeStepsKeyNotificationsUpdate(p.GetKeyNotificationsUpdate()), ClhDataUpdateTime: dcl.StringOrNil(p.GetClhDataUpdateTime()), PublicErrorMessage: dcl.StringOrNil(p.PublicErrorMessage), } for _, r := range p.GetQuotaRequestDeltas() { obj.QuotaRequestDeltas = append(obj.QuotaRequestDeltas, *ProtoToTier2AlphaInstancePreprocessGetRecipeStepsQuotaRequestDeltas(r)) } for _, r := range p.GetPermissionsInfo() { obj.PermissionsInfo = append(obj.PermissionsInfo, *ProtoToTier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfo(r)) } return obj } // ProtoToInstancePreprocessGetRecipeStepsStatus converts a InstancePreprocessGetRecipeStepsStatus resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessGetRecipeStepsStatus(p *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsStatus) *alpha.InstancePreprocessGetRecipeStepsStatus { if p == nil { return nil } obj := &alpha.InstancePreprocessGetRecipeStepsStatus{ Code: dcl.Int64OrNil(p.Code), Message: dcl.StringOrNil(p.Message), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstancePreprocessGetRecipeStepsStatusDetails(r)) } return obj } // ProtoToInstancePreprocessGetRecipeStepsStatusDetails converts a InstancePreprocessGetRecipeStepsStatusDetails resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessGetRecipeStepsStatusDetails(p *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsStatusDetails) *alpha.InstancePreprocessGetRecipeStepsStatusDetails { if p == nil { return nil } obj := &alpha.InstancePreprocessGetRecipeStepsStatusDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstancePreprocessGetRecipeStepsQuotaRequestDeltas converts a InstancePreprocessGetRecipeStepsQuotaRequestDeltas resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessGetRecipeStepsQuotaRequestDeltas(p *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsQuotaRequestDeltas) *alpha.InstancePreprocessGetRecipeStepsQuotaRequestDeltas { if p == nil { return nil } obj := &alpha.InstancePreprocessGetRecipeStepsQuotaRequestDeltas{ MetricName: dcl.StringOrNil(p.MetricName), Amount: dcl.Int64OrNil(p.Amount), QuotaLocationName: dcl.StringOrNil(p.QuotaLocationName), } return obj } // ProtoToInstancePreprocessGetRecipeStepsPreprocessUpdate converts a InstancePreprocessGetRecipeStepsPreprocessUpdate resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessGetRecipeStepsPreprocessUpdate(p *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsPreprocessUpdate) *alpha.InstancePreprocessGetRecipeStepsPreprocessUpdate { if p == nil { return nil } obj := &alpha.InstancePreprocessGetRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.StringOrNil(p.LatencySloBucketName), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), } return obj } // ProtoToInstancePreprocessGetRecipeStepsRequestedTenantProject converts a InstancePreprocessGetRecipeStepsRequestedTenantProject resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessGetRecipeStepsRequestedTenantProject(p *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsRequestedTenantProject) *alpha.InstancePreprocessGetRecipeStepsRequestedTenantProject { if p == nil { return nil } obj := &alpha.InstancePreprocessGetRecipeStepsRequestedTenantProject{ Tag: dcl.StringOrNil(p.Tag), Folder: dcl.StringOrNil(p.Folder), Scope: ProtoToTier2AlphaInstancePreprocessGetRecipeStepsRequestedTenantProjectScopeEnum(p.GetScope()), } return obj } // ProtoToInstancePreprocessGetRecipeStepsPermissionsInfo converts a InstancePreprocessGetRecipeStepsPermissionsInfo resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfo(p *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfo) *alpha.InstancePreprocessGetRecipeStepsPermissionsInfo { if p == nil { return nil } obj := &alpha.InstancePreprocessGetRecipeStepsPermissionsInfo{ PolicyName: ProtoToTier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoPolicyName(p.GetPolicyName()), ResourcePath: dcl.StringOrNil(p.ResourcePath), ApiAttrs: ProtoToTier2AlphaInstanceGoogleprotobufstruct(p.GetApiAttrs()), PolicyNameMode: ProtoToTier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoPolicyNameModeEnum(p.GetPolicyNameMode()), Resource: ProtoToTier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoResource(p.GetResource()), } for _, r := range p.GetIamPermissions() { obj.IamPermissions = append(obj.IamPermissions, *ProtoToTier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoIamPermissions(r)) } return obj } // ProtoToInstancePreprocessGetRecipeStepsPermissionsInfoPolicyName converts a InstancePreprocessGetRecipeStepsPermissionsInfoPolicyName resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoPolicyName(p *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoPolicyName) *alpha.InstancePreprocessGetRecipeStepsPermissionsInfoPolicyName { if p == nil { return nil } obj := &alpha.InstancePreprocessGetRecipeStepsPermissionsInfoPolicyName{ Type: dcl.StringOrNil(p.Type), Id: dcl.StringOrNil(p.Id), Region: dcl.StringOrNil(p.Region), } return obj } // ProtoToInstancePreprocessGetRecipeStepsPermissionsInfoIamPermissions converts a InstancePreprocessGetRecipeStepsPermissionsInfoIamPermissions resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoIamPermissions(p *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoIamPermissions) *alpha.InstancePreprocessGetRecipeStepsPermissionsInfoIamPermissions { if p == nil { return nil } obj := &alpha.InstancePreprocessGetRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.StringOrNil(p.Permission), } return obj } // ProtoToInstancePreprocessGetRecipeStepsPermissionsInfoResource converts a InstancePreprocessGetRecipeStepsPermissionsInfoResource resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoResource(p *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoResource) *alpha.InstancePreprocessGetRecipeStepsPermissionsInfoResource { if p == nil { return nil } obj := &alpha.InstancePreprocessGetRecipeStepsPermissionsInfoResource{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), Service: dcl.StringOrNil(p.Service), } return obj } // ProtoToInstancePreprocessGetRecipeStepsKeyNotificationsUpdate converts a InstancePreprocessGetRecipeStepsKeyNotificationsUpdate resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessGetRecipeStepsKeyNotificationsUpdate(p *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsKeyNotificationsUpdate) *alpha.InstancePreprocessGetRecipeStepsKeyNotificationsUpdate { if p == nil { return nil } obj := &alpha.InstancePreprocessGetRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: ProtoToTier2AlphaInstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p.GetKeyNotificationsInfo()), } return obj } // ProtoToInstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo converts a InstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alpha.InstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if p == nil { return nil } obj := &alpha.InstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.Int64OrNil(p.DataVersion), Delegate: dcl.StringOrNil(p.Delegate), } for _, r := range p.GetKeyNotificationConfigs() { obj.KeyNotificationConfigs = append(obj.KeyNotificationConfigs, *ProtoToTier2AlphaInstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(r)) } return obj } // ProtoToInstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs converts a InstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(p *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alpha.InstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if p == nil { return nil } obj := &alpha.InstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.StringOrNil(p.KeyOrVersionName), Grant: dcl.StringOrNil(p.Grant), DelegatorGaiaId: dcl.Int64OrNil(p.DelegatorGaiaId), } return obj } // ProtoToInstanceNotifyKeyAvailableRecipe converts a InstanceNotifyKeyAvailableRecipe resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipe(p *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipe) *alpha.InstanceNotifyKeyAvailableRecipe { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyAvailableRecipe{ HonorCancelRequest: dcl.Bool(p.HonorCancelRequest), IgnoreRecipeAfter: dcl.Int64OrNil(p.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.Float64OrNil(p.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.Bool(p.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.StringOrNil(p.GetReadonlyRecipeStartTime()), DelayToStoreResourcesInClhDbNanos: dcl.Int64OrNil(p.DelayToStoreResourcesInClhDbNanos), } for _, r := range p.GetSteps() { obj.Steps = append(obj.Steps, *ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeSteps(r)) } for _, r := range p.GetResourceNamesStoredInClhWithDelay() { obj.ResourceNamesStoredInClhWithDelay = append(obj.ResourceNamesStoredInClhWithDelay, r) } return obj } // ProtoToInstanceNotifyKeyAvailableRecipeSteps converts a InstanceNotifyKeyAvailableRecipeSteps resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeSteps(p *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeSteps) *alpha.InstanceNotifyKeyAvailableRecipeSteps { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyAvailableRecipeSteps{ RelativeTime: dcl.Int64OrNil(p.RelativeTime), SleepDuration: dcl.Int64OrNil(p.SleepDuration), Action: ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsActionEnum(p.GetAction()), Status: ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsStatus(p.GetStatus()), ErrorSpace: dcl.StringOrNil(p.ErrorSpace), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), ResourceMetadataSize: dcl.Int64OrNil(p.ResourceMetadataSize), Description: dcl.StringOrNil(p.Description), UpdatedRepeatOperationDelaySec: dcl.Float64OrNil(p.UpdatedRepeatOperationDelaySec), PreprocessUpdate: ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsPreprocessUpdate(p.GetPreprocessUpdate()), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), RequestedTenantProject: ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsRequestedTenantProject(p.GetRequestedTenantProject()), KeyNotificationsUpdate: ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdate(p.GetKeyNotificationsUpdate()), ClhDataUpdateTime: dcl.StringOrNil(p.GetClhDataUpdateTime()), PublicErrorMessage: dcl.StringOrNil(p.PublicErrorMessage), } for _, r := range p.GetQuotaRequestDeltas() { obj.QuotaRequestDeltas = append(obj.QuotaRequestDeltas, *ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsQuotaRequestDeltas(r)) } for _, r := range p.GetPermissionsInfo() { obj.PermissionsInfo = append(obj.PermissionsInfo, *ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfo(r)) } return obj } // ProtoToInstanceNotifyKeyAvailableRecipeStepsStatus converts a InstanceNotifyKeyAvailableRecipeStepsStatus resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsStatus(p *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsStatus) *alpha.InstanceNotifyKeyAvailableRecipeStepsStatus { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyAvailableRecipeStepsStatus{ Code: dcl.Int64OrNil(p.Code), Message: dcl.StringOrNil(p.Message), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsStatusDetails(r)) } return obj } // ProtoToInstanceNotifyKeyAvailableRecipeStepsStatusDetails converts a InstanceNotifyKeyAvailableRecipeStepsStatusDetails resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsStatusDetails(p *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsStatusDetails) *alpha.InstanceNotifyKeyAvailableRecipeStepsStatusDetails { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyAvailableRecipeStepsStatusDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstanceNotifyKeyAvailableRecipeStepsQuotaRequestDeltas converts a InstanceNotifyKeyAvailableRecipeStepsQuotaRequestDeltas resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsQuotaRequestDeltas(p *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsQuotaRequestDeltas) *alpha.InstanceNotifyKeyAvailableRecipeStepsQuotaRequestDeltas { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyAvailableRecipeStepsQuotaRequestDeltas{ MetricName: dcl.StringOrNil(p.MetricName), Amount: dcl.Int64OrNil(p.Amount), QuotaLocationName: dcl.StringOrNil(p.QuotaLocationName), } return obj } // ProtoToInstanceNotifyKeyAvailableRecipeStepsPreprocessUpdate converts a InstanceNotifyKeyAvailableRecipeStepsPreprocessUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsPreprocessUpdate(p *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPreprocessUpdate) *alpha.InstanceNotifyKeyAvailableRecipeStepsPreprocessUpdate { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyAvailableRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.StringOrNil(p.LatencySloBucketName), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), } return obj } // ProtoToInstanceNotifyKeyAvailableRecipeStepsRequestedTenantProject converts a InstanceNotifyKeyAvailableRecipeStepsRequestedTenantProject resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsRequestedTenantProject(p *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsRequestedTenantProject) *alpha.InstanceNotifyKeyAvailableRecipeStepsRequestedTenantProject { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyAvailableRecipeStepsRequestedTenantProject{ Tag: dcl.StringOrNil(p.Tag), Folder: dcl.StringOrNil(p.Folder), Scope: ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsRequestedTenantProjectScopeEnum(p.GetScope()), } return obj } // ProtoToInstanceNotifyKeyAvailableRecipeStepsPermissionsInfo converts a InstanceNotifyKeyAvailableRecipeStepsPermissionsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfo(p *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfo) *alpha.InstanceNotifyKeyAvailableRecipeStepsPermissionsInfo { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyAvailableRecipeStepsPermissionsInfo{ PolicyName: ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyName(p.GetPolicyName()), ResourcePath: dcl.StringOrNil(p.ResourcePath), ApiAttrs: ProtoToTier2AlphaInstanceGoogleprotobufstruct(p.GetApiAttrs()), PolicyNameMode: ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyNameModeEnum(p.GetPolicyNameMode()), Resource: ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoResource(p.GetResource()), } for _, r := range p.GetIamPermissions() { obj.IamPermissions = append(obj.IamPermissions, *ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoIamPermissions(r)) } return obj } // ProtoToInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyName converts a InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyName resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyName(p *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyName) *alpha.InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyName { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyName{ Type: dcl.StringOrNil(p.Type), Id: dcl.StringOrNil(p.Id), Region: dcl.StringOrNil(p.Region), } return obj } // ProtoToInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoIamPermissions converts a InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoIamPermissions resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoIamPermissions(p *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoIamPermissions) *alpha.InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoIamPermissions { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.StringOrNil(p.Permission), } return obj } // ProtoToInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoResource converts a InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoResource resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoResource(p *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoResource) *alpha.InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoResource { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoResource{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), Service: dcl.StringOrNil(p.Service), } return obj } // ProtoToInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdate converts a InstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdate(p *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdate) *alpha.InstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdate { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p.GetKeyNotificationsInfo()), } return obj } // ProtoToInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo converts a InstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alpha.InstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.Int64OrNil(p.DataVersion), Delegate: dcl.StringOrNil(p.Delegate), } for _, r := range p.GetKeyNotificationConfigs() { obj.KeyNotificationConfigs = append(obj.KeyNotificationConfigs, *ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(r)) } return obj } // ProtoToInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs converts a InstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(p *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alpha.InstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.StringOrNil(p.KeyOrVersionName), Grant: dcl.StringOrNil(p.Grant), DelegatorGaiaId: dcl.Int64OrNil(p.DelegatorGaiaId), } return obj } // ProtoToInstanceNotifyKeyUnavailableRecipe converts a InstanceNotifyKeyUnavailableRecipe resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipe(p *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipe) *alpha.InstanceNotifyKeyUnavailableRecipe { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyUnavailableRecipe{ HonorCancelRequest: dcl.Bool(p.HonorCancelRequest), IgnoreRecipeAfter: dcl.Int64OrNil(p.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.Float64OrNil(p.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.Bool(p.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.StringOrNil(p.GetReadonlyRecipeStartTime()), DelayToStoreResourcesInClhDbNanos: dcl.Int64OrNil(p.DelayToStoreResourcesInClhDbNanos), } for _, r := range p.GetSteps() { obj.Steps = append(obj.Steps, *ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeSteps(r)) } for _, r := range p.GetResourceNamesStoredInClhWithDelay() { obj.ResourceNamesStoredInClhWithDelay = append(obj.ResourceNamesStoredInClhWithDelay, r) } return obj } // ProtoToInstanceNotifyKeyUnavailableRecipeSteps converts a InstanceNotifyKeyUnavailableRecipeSteps resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeSteps(p *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeSteps) *alpha.InstanceNotifyKeyUnavailableRecipeSteps { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyUnavailableRecipeSteps{ RelativeTime: dcl.Int64OrNil(p.RelativeTime), SleepDuration: dcl.Int64OrNil(p.SleepDuration), Action: ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsActionEnum(p.GetAction()), Status: ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsStatus(p.GetStatus()), ErrorSpace: dcl.StringOrNil(p.ErrorSpace), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), ResourceMetadataSize: dcl.Int64OrNil(p.ResourceMetadataSize), Description: dcl.StringOrNil(p.Description), UpdatedRepeatOperationDelaySec: dcl.Float64OrNil(p.UpdatedRepeatOperationDelaySec), PreprocessUpdate: ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPreprocessUpdate(p.GetPreprocessUpdate()), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), RequestedTenantProject: ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProject(p.GetRequestedTenantProject()), KeyNotificationsUpdate: ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdate(p.GetKeyNotificationsUpdate()), ClhDataUpdateTime: dcl.StringOrNil(p.GetClhDataUpdateTime()), PublicErrorMessage: dcl.StringOrNil(p.PublicErrorMessage), } for _, r := range p.GetQuotaRequestDeltas() { obj.QuotaRequestDeltas = append(obj.QuotaRequestDeltas, *ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsQuotaRequestDeltas(r)) } for _, r := range p.GetPermissionsInfo() { obj.PermissionsInfo = append(obj.PermissionsInfo, *ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfo(r)) } return obj } // ProtoToInstanceNotifyKeyUnavailableRecipeStepsStatus converts a InstanceNotifyKeyUnavailableRecipeStepsStatus resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsStatus(p *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsStatus) *alpha.InstanceNotifyKeyUnavailableRecipeStepsStatus { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyUnavailableRecipeStepsStatus{ Code: dcl.Int64OrNil(p.Code), Message: dcl.StringOrNil(p.Message), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsStatusDetails(r)) } return obj } // ProtoToInstanceNotifyKeyUnavailableRecipeStepsStatusDetails converts a InstanceNotifyKeyUnavailableRecipeStepsStatusDetails resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsStatusDetails(p *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsStatusDetails) *alpha.InstanceNotifyKeyUnavailableRecipeStepsStatusDetails { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyUnavailableRecipeStepsStatusDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstanceNotifyKeyUnavailableRecipeStepsQuotaRequestDeltas converts a InstanceNotifyKeyUnavailableRecipeStepsQuotaRequestDeltas resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsQuotaRequestDeltas(p *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsQuotaRequestDeltas) *alpha.InstanceNotifyKeyUnavailableRecipeStepsQuotaRequestDeltas { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyUnavailableRecipeStepsQuotaRequestDeltas{ MetricName: dcl.StringOrNil(p.MetricName), Amount: dcl.Int64OrNil(p.Amount), QuotaLocationName: dcl.StringOrNil(p.QuotaLocationName), } return obj } // ProtoToInstanceNotifyKeyUnavailableRecipeStepsPreprocessUpdate converts a InstanceNotifyKeyUnavailableRecipeStepsPreprocessUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPreprocessUpdate(p *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPreprocessUpdate) *alpha.InstanceNotifyKeyUnavailableRecipeStepsPreprocessUpdate { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyUnavailableRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.StringOrNil(p.LatencySloBucketName), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), } return obj } // ProtoToInstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProject converts a InstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProject resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProject(p *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProject) *alpha.InstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProject { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProject{ Tag: dcl.StringOrNil(p.Tag), Folder: dcl.StringOrNil(p.Folder), Scope: ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProjectScopeEnum(p.GetScope()), } return obj } // ProtoToInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfo converts a InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfo(p *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfo) *alpha.InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfo { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfo{ PolicyName: ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyName(p.GetPolicyName()), ResourcePath: dcl.StringOrNil(p.ResourcePath), ApiAttrs: ProtoToTier2AlphaInstanceGoogleprotobufstruct(p.GetApiAttrs()), PolicyNameMode: ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyNameModeEnum(p.GetPolicyNameMode()), Resource: ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoResource(p.GetResource()), } for _, r := range p.GetIamPermissions() { obj.IamPermissions = append(obj.IamPermissions, *ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoIamPermissions(r)) } return obj } // ProtoToInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyName converts a InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyName resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyName(p *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyName) *alpha.InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyName { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyName{ Type: dcl.StringOrNil(p.Type), Id: dcl.StringOrNil(p.Id), Region: dcl.StringOrNil(p.Region), } return obj } // ProtoToInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoIamPermissions converts a InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoIamPermissions resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoIamPermissions(p *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoIamPermissions) *alpha.InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoIamPermissions { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.StringOrNil(p.Permission), } return obj } // ProtoToInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoResource converts a InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoResource resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoResource(p *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoResource) *alpha.InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoResource { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoResource{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), Service: dcl.StringOrNil(p.Service), } return obj } // ProtoToInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdate converts a InstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdate(p *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdate) *alpha.InstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdate { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p.GetKeyNotificationsInfo()), } return obj } // ProtoToInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo converts a InstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alpha.InstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.Int64OrNil(p.DataVersion), Delegate: dcl.StringOrNil(p.Delegate), } for _, r := range p.GetKeyNotificationConfigs() { obj.KeyNotificationConfigs = append(obj.KeyNotificationConfigs, *ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(r)) } return obj } // ProtoToInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs converts a InstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource from its proto representation. func ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(p *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alpha.InstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if p == nil { return nil } obj := &alpha.InstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.StringOrNil(p.KeyOrVersionName), Grant: dcl.StringOrNil(p.Grant), DelegatorGaiaId: dcl.Int64OrNil(p.DelegatorGaiaId), } return obj } // ProtoToInstanceReadonlyRecipe converts a InstanceReadonlyRecipe resource from its proto representation. func ProtoToTier2AlphaInstanceReadonlyRecipe(p *alphapb.Tier2AlphaInstanceReadonlyRecipe) *alpha.InstanceReadonlyRecipe { if p == nil { return nil } obj := &alpha.InstanceReadonlyRecipe{ HonorCancelRequest: dcl.Bool(p.HonorCancelRequest), IgnoreRecipeAfter: dcl.Int64OrNil(p.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.Float64OrNil(p.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.Bool(p.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.StringOrNil(p.GetReadonlyRecipeStartTime()), DelayToStoreResourcesInClhDbNanos: dcl.Int64OrNil(p.DelayToStoreResourcesInClhDbNanos), } for _, r := range p.GetSteps() { obj.Steps = append(obj.Steps, *ProtoToTier2AlphaInstanceReadonlyRecipeSteps(r)) } for _, r := range p.GetResourceNamesStoredInClhWithDelay() { obj.ResourceNamesStoredInClhWithDelay = append(obj.ResourceNamesStoredInClhWithDelay, r) } return obj } // ProtoToInstanceReadonlyRecipeSteps converts a InstanceReadonlyRecipeSteps resource from its proto representation. func ProtoToTier2AlphaInstanceReadonlyRecipeSteps(p *alphapb.Tier2AlphaInstanceReadonlyRecipeSteps) *alpha.InstanceReadonlyRecipeSteps { if p == nil { return nil } obj := &alpha.InstanceReadonlyRecipeSteps{ RelativeTime: dcl.Int64OrNil(p.RelativeTime), SleepDuration: dcl.Int64OrNil(p.SleepDuration), Action: ProtoToTier2AlphaInstanceReadonlyRecipeStepsActionEnum(p.GetAction()), Status: ProtoToTier2AlphaInstanceReadonlyRecipeStepsStatus(p.GetStatus()), ErrorSpace: dcl.StringOrNil(p.ErrorSpace), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), ResourceMetadataSize: dcl.Int64OrNil(p.ResourceMetadataSize), Description: dcl.StringOrNil(p.Description), UpdatedRepeatOperationDelaySec: dcl.Float64OrNil(p.UpdatedRepeatOperationDelaySec), PreprocessUpdate: ProtoToTier2AlphaInstanceReadonlyRecipeStepsPreprocessUpdate(p.GetPreprocessUpdate()), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), RequestedTenantProject: ProtoToTier2AlphaInstanceReadonlyRecipeStepsRequestedTenantProject(p.GetRequestedTenantProject()), KeyNotificationsUpdate: ProtoToTier2AlphaInstanceReadonlyRecipeStepsKeyNotificationsUpdate(p.GetKeyNotificationsUpdate()), ClhDataUpdateTime: dcl.StringOrNil(p.GetClhDataUpdateTime()), PublicErrorMessage: dcl.StringOrNil(p.PublicErrorMessage), } for _, r := range p.GetQuotaRequestDeltas() { obj.QuotaRequestDeltas = append(obj.QuotaRequestDeltas, *ProtoToTier2AlphaInstanceReadonlyRecipeStepsQuotaRequestDeltas(r)) } for _, r := range p.GetPermissionsInfo() { obj.PermissionsInfo = append(obj.PermissionsInfo, *ProtoToTier2AlphaInstanceReadonlyRecipeStepsPermissionsInfo(r)) } return obj } // ProtoToInstanceReadonlyRecipeStepsStatus converts a InstanceReadonlyRecipeStepsStatus resource from its proto representation. func ProtoToTier2AlphaInstanceReadonlyRecipeStepsStatus(p *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsStatus) *alpha.InstanceReadonlyRecipeStepsStatus { if p == nil { return nil } obj := &alpha.InstanceReadonlyRecipeStepsStatus{ Code: dcl.Int64OrNil(p.Code), Message: dcl.StringOrNil(p.Message), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstanceReadonlyRecipeStepsStatusDetails(r)) } return obj } // ProtoToInstanceReadonlyRecipeStepsStatusDetails converts a InstanceReadonlyRecipeStepsStatusDetails resource from its proto representation. func ProtoToTier2AlphaInstanceReadonlyRecipeStepsStatusDetails(p *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsStatusDetails) *alpha.InstanceReadonlyRecipeStepsStatusDetails { if p == nil { return nil } obj := &alpha.InstanceReadonlyRecipeStepsStatusDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstanceReadonlyRecipeStepsQuotaRequestDeltas converts a InstanceReadonlyRecipeStepsQuotaRequestDeltas resource from its proto representation. func ProtoToTier2AlphaInstanceReadonlyRecipeStepsQuotaRequestDeltas(p *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsQuotaRequestDeltas) *alpha.InstanceReadonlyRecipeStepsQuotaRequestDeltas { if p == nil { return nil } obj := &alpha.InstanceReadonlyRecipeStepsQuotaRequestDeltas{ MetricName: dcl.StringOrNil(p.MetricName), Amount: dcl.Int64OrNil(p.Amount), QuotaLocationName: dcl.StringOrNil(p.QuotaLocationName), } return obj } // ProtoToInstanceReadonlyRecipeStepsPreprocessUpdate converts a InstanceReadonlyRecipeStepsPreprocessUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceReadonlyRecipeStepsPreprocessUpdate(p *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsPreprocessUpdate) *alpha.InstanceReadonlyRecipeStepsPreprocessUpdate { if p == nil { return nil } obj := &alpha.InstanceReadonlyRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.StringOrNil(p.LatencySloBucketName), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), } return obj } // ProtoToInstanceReadonlyRecipeStepsRequestedTenantProject converts a InstanceReadonlyRecipeStepsRequestedTenantProject resource from its proto representation. func ProtoToTier2AlphaInstanceReadonlyRecipeStepsRequestedTenantProject(p *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsRequestedTenantProject) *alpha.InstanceReadonlyRecipeStepsRequestedTenantProject { if p == nil { return nil } obj := &alpha.InstanceReadonlyRecipeStepsRequestedTenantProject{ Tag: dcl.StringOrNil(p.Tag), Folder: dcl.StringOrNil(p.Folder), Scope: ProtoToTier2AlphaInstanceReadonlyRecipeStepsRequestedTenantProjectScopeEnum(p.GetScope()), } return obj } // ProtoToInstanceReadonlyRecipeStepsPermissionsInfo converts a InstanceReadonlyRecipeStepsPermissionsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceReadonlyRecipeStepsPermissionsInfo(p *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfo) *alpha.InstanceReadonlyRecipeStepsPermissionsInfo { if p == nil { return nil } obj := &alpha.InstanceReadonlyRecipeStepsPermissionsInfo{ PolicyName: ProtoToTier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoPolicyName(p.GetPolicyName()), ResourcePath: dcl.StringOrNil(p.ResourcePath), ApiAttrs: ProtoToTier2AlphaInstanceGoogleprotobufstruct(p.GetApiAttrs()), PolicyNameMode: ProtoToTier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoPolicyNameModeEnum(p.GetPolicyNameMode()), Resource: ProtoToTier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoResource(p.GetResource()), } for _, r := range p.GetIamPermissions() { obj.IamPermissions = append(obj.IamPermissions, *ProtoToTier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoIamPermissions(r)) } return obj } // ProtoToInstanceReadonlyRecipeStepsPermissionsInfoPolicyName converts a InstanceReadonlyRecipeStepsPermissionsInfoPolicyName resource from its proto representation. func ProtoToTier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoPolicyName(p *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoPolicyName) *alpha.InstanceReadonlyRecipeStepsPermissionsInfoPolicyName { if p == nil { return nil } obj := &alpha.InstanceReadonlyRecipeStepsPermissionsInfoPolicyName{ Type: dcl.StringOrNil(p.Type), Id: dcl.StringOrNil(p.Id), Region: dcl.StringOrNil(p.Region), } return obj } // ProtoToInstanceReadonlyRecipeStepsPermissionsInfoIamPermissions converts a InstanceReadonlyRecipeStepsPermissionsInfoIamPermissions resource from its proto representation. func ProtoToTier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoIamPermissions(p *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoIamPermissions) *alpha.InstanceReadonlyRecipeStepsPermissionsInfoIamPermissions { if p == nil { return nil } obj := &alpha.InstanceReadonlyRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.StringOrNil(p.Permission), } return obj } // ProtoToInstanceReadonlyRecipeStepsPermissionsInfoResource converts a InstanceReadonlyRecipeStepsPermissionsInfoResource resource from its proto representation. func ProtoToTier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoResource(p *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoResource) *alpha.InstanceReadonlyRecipeStepsPermissionsInfoResource { if p == nil { return nil } obj := &alpha.InstanceReadonlyRecipeStepsPermissionsInfoResource{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), Service: dcl.StringOrNil(p.Service), } return obj } // ProtoToInstanceReadonlyRecipeStepsKeyNotificationsUpdate converts a InstanceReadonlyRecipeStepsKeyNotificationsUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceReadonlyRecipeStepsKeyNotificationsUpdate(p *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsKeyNotificationsUpdate) *alpha.InstanceReadonlyRecipeStepsKeyNotificationsUpdate { if p == nil { return nil } obj := &alpha.InstanceReadonlyRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: ProtoToTier2AlphaInstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p.GetKeyNotificationsInfo()), } return obj } // ProtoToInstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo converts a InstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alpha.InstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if p == nil { return nil } obj := &alpha.InstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.Int64OrNil(p.DataVersion), Delegate: dcl.StringOrNil(p.Delegate), } for _, r := range p.GetKeyNotificationConfigs() { obj.KeyNotificationConfigs = append(obj.KeyNotificationConfigs, *ProtoToTier2AlphaInstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(r)) } return obj } // ProtoToInstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs converts a InstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource from its proto representation. func ProtoToTier2AlphaInstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(p *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alpha.InstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if p == nil { return nil } obj := &alpha.InstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.StringOrNil(p.KeyOrVersionName), Grant: dcl.StringOrNil(p.Grant), DelegatorGaiaId: dcl.Int64OrNil(p.DelegatorGaiaId), } return obj } // ProtoToInstanceReconcileRecipe converts a InstanceReconcileRecipe resource from its proto representation. func ProtoToTier2AlphaInstanceReconcileRecipe(p *alphapb.Tier2AlphaInstanceReconcileRecipe) *alpha.InstanceReconcileRecipe { if p == nil { return nil } obj := &alpha.InstanceReconcileRecipe{ HonorCancelRequest: dcl.Bool(p.HonorCancelRequest), IgnoreRecipeAfter: dcl.Int64OrNil(p.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.Float64OrNil(p.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.Bool(p.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.StringOrNil(p.GetReadonlyRecipeStartTime()), DelayToStoreResourcesInClhDbNanos: dcl.Int64OrNil(p.DelayToStoreResourcesInClhDbNanos), } for _, r := range p.GetSteps() { obj.Steps = append(obj.Steps, *ProtoToTier2AlphaInstanceReconcileRecipeSteps(r)) } for _, r := range p.GetResourceNamesStoredInClhWithDelay() { obj.ResourceNamesStoredInClhWithDelay = append(obj.ResourceNamesStoredInClhWithDelay, r) } return obj } // ProtoToInstanceReconcileRecipeSteps converts a InstanceReconcileRecipeSteps resource from its proto representation. func ProtoToTier2AlphaInstanceReconcileRecipeSteps(p *alphapb.Tier2AlphaInstanceReconcileRecipeSteps) *alpha.InstanceReconcileRecipeSteps { if p == nil { return nil } obj := &alpha.InstanceReconcileRecipeSteps{ RelativeTime: dcl.Int64OrNil(p.RelativeTime), SleepDuration: dcl.Int64OrNil(p.SleepDuration), Action: ProtoToTier2AlphaInstanceReconcileRecipeStepsActionEnum(p.GetAction()), Status: ProtoToTier2AlphaInstanceReconcileRecipeStepsStatus(p.GetStatus()), ErrorSpace: dcl.StringOrNil(p.ErrorSpace), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), ResourceMetadataSize: dcl.Int64OrNil(p.ResourceMetadataSize), Description: dcl.StringOrNil(p.Description), UpdatedRepeatOperationDelaySec: dcl.Float64OrNil(p.UpdatedRepeatOperationDelaySec), PreprocessUpdate: ProtoToTier2AlphaInstanceReconcileRecipeStepsPreprocessUpdate(p.GetPreprocessUpdate()), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), RequestedTenantProject: ProtoToTier2AlphaInstanceReconcileRecipeStepsRequestedTenantProject(p.GetRequestedTenantProject()), KeyNotificationsUpdate: ProtoToTier2AlphaInstanceReconcileRecipeStepsKeyNotificationsUpdate(p.GetKeyNotificationsUpdate()), ClhDataUpdateTime: dcl.StringOrNil(p.GetClhDataUpdateTime()), PublicErrorMessage: dcl.StringOrNil(p.PublicErrorMessage), } for _, r := range p.GetQuotaRequestDeltas() { obj.QuotaRequestDeltas = append(obj.QuotaRequestDeltas, *ProtoToTier2AlphaInstanceReconcileRecipeStepsQuotaRequestDeltas(r)) } for _, r := range p.GetPermissionsInfo() { obj.PermissionsInfo = append(obj.PermissionsInfo, *ProtoToTier2AlphaInstanceReconcileRecipeStepsPermissionsInfo(r)) } return obj } // ProtoToInstanceReconcileRecipeStepsStatus converts a InstanceReconcileRecipeStepsStatus resource from its proto representation. func ProtoToTier2AlphaInstanceReconcileRecipeStepsStatus(p *alphapb.Tier2AlphaInstanceReconcileRecipeStepsStatus) *alpha.InstanceReconcileRecipeStepsStatus { if p == nil { return nil } obj := &alpha.InstanceReconcileRecipeStepsStatus{ Code: dcl.Int64OrNil(p.Code), Message: dcl.StringOrNil(p.Message), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstanceReconcileRecipeStepsStatusDetails(r)) } return obj } // ProtoToInstanceReconcileRecipeStepsStatusDetails converts a InstanceReconcileRecipeStepsStatusDetails resource from its proto representation. func ProtoToTier2AlphaInstanceReconcileRecipeStepsStatusDetails(p *alphapb.Tier2AlphaInstanceReconcileRecipeStepsStatusDetails) *alpha.InstanceReconcileRecipeStepsStatusDetails { if p == nil { return nil } obj := &alpha.InstanceReconcileRecipeStepsStatusDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstanceReconcileRecipeStepsQuotaRequestDeltas converts a InstanceReconcileRecipeStepsQuotaRequestDeltas resource from its proto representation. func ProtoToTier2AlphaInstanceReconcileRecipeStepsQuotaRequestDeltas(p *alphapb.Tier2AlphaInstanceReconcileRecipeStepsQuotaRequestDeltas) *alpha.InstanceReconcileRecipeStepsQuotaRequestDeltas { if p == nil { return nil } obj := &alpha.InstanceReconcileRecipeStepsQuotaRequestDeltas{ MetricName: dcl.StringOrNil(p.MetricName), Amount: dcl.Int64OrNil(p.Amount), QuotaLocationName: dcl.StringOrNil(p.QuotaLocationName), } return obj } // ProtoToInstanceReconcileRecipeStepsPreprocessUpdate converts a InstanceReconcileRecipeStepsPreprocessUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceReconcileRecipeStepsPreprocessUpdate(p *alphapb.Tier2AlphaInstanceReconcileRecipeStepsPreprocessUpdate) *alpha.InstanceReconcileRecipeStepsPreprocessUpdate { if p == nil { return nil } obj := &alpha.InstanceReconcileRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.StringOrNil(p.LatencySloBucketName), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), } return obj } // ProtoToInstanceReconcileRecipeStepsRequestedTenantProject converts a InstanceReconcileRecipeStepsRequestedTenantProject resource from its proto representation. func ProtoToTier2AlphaInstanceReconcileRecipeStepsRequestedTenantProject(p *alphapb.Tier2AlphaInstanceReconcileRecipeStepsRequestedTenantProject) *alpha.InstanceReconcileRecipeStepsRequestedTenantProject { if p == nil { return nil } obj := &alpha.InstanceReconcileRecipeStepsRequestedTenantProject{ Tag: dcl.StringOrNil(p.Tag), Folder: dcl.StringOrNil(p.Folder), Scope: ProtoToTier2AlphaInstanceReconcileRecipeStepsRequestedTenantProjectScopeEnum(p.GetScope()), } return obj } // ProtoToInstanceReconcileRecipeStepsPermissionsInfo converts a InstanceReconcileRecipeStepsPermissionsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceReconcileRecipeStepsPermissionsInfo(p *alphapb.Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfo) *alpha.InstanceReconcileRecipeStepsPermissionsInfo { if p == nil { return nil } obj := &alpha.InstanceReconcileRecipeStepsPermissionsInfo{ PolicyName: ProtoToTier2AlphaInstanceReconcileRecipeStepsPermissionsInfoPolicyName(p.GetPolicyName()), ResourcePath: dcl.StringOrNil(p.ResourcePath), ApiAttrs: ProtoToTier2AlphaInstanceGoogleprotobufstruct(p.GetApiAttrs()), PolicyNameMode: ProtoToTier2AlphaInstanceReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum(p.GetPolicyNameMode()), Resource: ProtoToTier2AlphaInstanceReconcileRecipeStepsPermissionsInfoResource(p.GetResource()), } for _, r := range p.GetIamPermissions() { obj.IamPermissions = append(obj.IamPermissions, *ProtoToTier2AlphaInstanceReconcileRecipeStepsPermissionsInfoIamPermissions(r)) } return obj } // ProtoToInstanceReconcileRecipeStepsPermissionsInfoPolicyName converts a InstanceReconcileRecipeStepsPermissionsInfoPolicyName resource from its proto representation. func ProtoToTier2AlphaInstanceReconcileRecipeStepsPermissionsInfoPolicyName(p *alphapb.Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoPolicyName) *alpha.InstanceReconcileRecipeStepsPermissionsInfoPolicyName { if p == nil { return nil } obj := &alpha.InstanceReconcileRecipeStepsPermissionsInfoPolicyName{ Type: dcl.StringOrNil(p.Type), Id: dcl.StringOrNil(p.Id), Region: dcl.StringOrNil(p.Region), } return obj } // ProtoToInstanceReconcileRecipeStepsPermissionsInfoIamPermissions converts a InstanceReconcileRecipeStepsPermissionsInfoIamPermissions resource from its proto representation. func ProtoToTier2AlphaInstanceReconcileRecipeStepsPermissionsInfoIamPermissions(p *alphapb.Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoIamPermissions) *alpha.InstanceReconcileRecipeStepsPermissionsInfoIamPermissions { if p == nil { return nil } obj := &alpha.InstanceReconcileRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.StringOrNil(p.Permission), } return obj } // ProtoToInstanceReconcileRecipeStepsPermissionsInfoResource converts a InstanceReconcileRecipeStepsPermissionsInfoResource resource from its proto representation. func ProtoToTier2AlphaInstanceReconcileRecipeStepsPermissionsInfoResource(p *alphapb.Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoResource) *alpha.InstanceReconcileRecipeStepsPermissionsInfoResource { if p == nil { return nil } obj := &alpha.InstanceReconcileRecipeStepsPermissionsInfoResource{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), Service: dcl.StringOrNil(p.Service), } return obj } // ProtoToInstanceReconcileRecipeStepsKeyNotificationsUpdate converts a InstanceReconcileRecipeStepsKeyNotificationsUpdate resource from its proto representation. func ProtoToTier2AlphaInstanceReconcileRecipeStepsKeyNotificationsUpdate(p *alphapb.Tier2AlphaInstanceReconcileRecipeStepsKeyNotificationsUpdate) *alpha.InstanceReconcileRecipeStepsKeyNotificationsUpdate { if p == nil { return nil } obj := &alpha.InstanceReconcileRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: ProtoToTier2AlphaInstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p.GetKeyNotificationsInfo()), } return obj } // ProtoToInstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo converts a InstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource from its proto representation. func ProtoToTier2AlphaInstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p *alphapb.Tier2AlphaInstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alpha.InstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if p == nil { return nil } obj := &alpha.InstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.Int64OrNil(p.DataVersion), Delegate: dcl.StringOrNil(p.Delegate), } for _, r := range p.GetKeyNotificationConfigs() { obj.KeyNotificationConfigs = append(obj.KeyNotificationConfigs, *ProtoToTier2AlphaInstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(r)) } return obj } // ProtoToInstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs converts a InstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource from its proto representation. func ProtoToTier2AlphaInstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(p *alphapb.Tier2AlphaInstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alpha.InstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if p == nil { return nil } obj := &alpha.InstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.StringOrNil(p.KeyOrVersionName), Grant: dcl.StringOrNil(p.Grant), DelegatorGaiaId: dcl.Int64OrNil(p.DelegatorGaiaId), } return obj } // ProtoToInstancePreprocessPassthroughRecipe converts a InstancePreprocessPassthroughRecipe resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessPassthroughRecipe(p *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipe) *alpha.InstancePreprocessPassthroughRecipe { if p == nil { return nil } obj := &alpha.InstancePreprocessPassthroughRecipe{ HonorCancelRequest: dcl.Bool(p.HonorCancelRequest), IgnoreRecipeAfter: dcl.Int64OrNil(p.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.Float64OrNil(p.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.Bool(p.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.StringOrNil(p.GetReadonlyRecipeStartTime()), DelayToStoreResourcesInClhDbNanos: dcl.Int64OrNil(p.DelayToStoreResourcesInClhDbNanos), } for _, r := range p.GetSteps() { obj.Steps = append(obj.Steps, *ProtoToTier2AlphaInstancePreprocessPassthroughRecipeSteps(r)) } for _, r := range p.GetResourceNamesStoredInClhWithDelay() { obj.ResourceNamesStoredInClhWithDelay = append(obj.ResourceNamesStoredInClhWithDelay, r) } return obj } // ProtoToInstancePreprocessPassthroughRecipeSteps converts a InstancePreprocessPassthroughRecipeSteps resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessPassthroughRecipeSteps(p *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeSteps) *alpha.InstancePreprocessPassthroughRecipeSteps { if p == nil { return nil } obj := &alpha.InstancePreprocessPassthroughRecipeSteps{ RelativeTime: dcl.Int64OrNil(p.RelativeTime), SleepDuration: dcl.Int64OrNil(p.SleepDuration), Action: ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsActionEnum(p.GetAction()), Status: ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsStatus(p.GetStatus()), ErrorSpace: dcl.StringOrNil(p.ErrorSpace), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), ResourceMetadataSize: dcl.Int64OrNil(p.ResourceMetadataSize), Description: dcl.StringOrNil(p.Description), UpdatedRepeatOperationDelaySec: dcl.Float64OrNil(p.UpdatedRepeatOperationDelaySec), PreprocessUpdate: ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsPreprocessUpdate(p.GetPreprocessUpdate()), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), RequestedTenantProject: ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsRequestedTenantProject(p.GetRequestedTenantProject()), KeyNotificationsUpdate: ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdate(p.GetKeyNotificationsUpdate()), ClhDataUpdateTime: dcl.StringOrNil(p.GetClhDataUpdateTime()), PublicErrorMessage: dcl.StringOrNil(p.PublicErrorMessage), } for _, r := range p.GetQuotaRequestDeltas() { obj.QuotaRequestDeltas = append(obj.QuotaRequestDeltas, *ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsQuotaRequestDeltas(r)) } for _, r := range p.GetPermissionsInfo() { obj.PermissionsInfo = append(obj.PermissionsInfo, *ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfo(r)) } return obj } // ProtoToInstancePreprocessPassthroughRecipeStepsStatus converts a InstancePreprocessPassthroughRecipeStepsStatus resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsStatus(p *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsStatus) *alpha.InstancePreprocessPassthroughRecipeStepsStatus { if p == nil { return nil } obj := &alpha.InstancePreprocessPassthroughRecipeStepsStatus{ Code: dcl.Int64OrNil(p.Code), Message: dcl.StringOrNil(p.Message), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsStatusDetails(r)) } return obj } // ProtoToInstancePreprocessPassthroughRecipeStepsStatusDetails converts a InstancePreprocessPassthroughRecipeStepsStatusDetails resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsStatusDetails(p *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsStatusDetails) *alpha.InstancePreprocessPassthroughRecipeStepsStatusDetails { if p == nil { return nil } obj := &alpha.InstancePreprocessPassthroughRecipeStepsStatusDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstancePreprocessPassthroughRecipeStepsQuotaRequestDeltas converts a InstancePreprocessPassthroughRecipeStepsQuotaRequestDeltas resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsQuotaRequestDeltas(p *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsQuotaRequestDeltas) *alpha.InstancePreprocessPassthroughRecipeStepsQuotaRequestDeltas { if p == nil { return nil } obj := &alpha.InstancePreprocessPassthroughRecipeStepsQuotaRequestDeltas{ MetricName: dcl.StringOrNil(p.MetricName), Amount: dcl.Int64OrNil(p.Amount), QuotaLocationName: dcl.StringOrNil(p.QuotaLocationName), } return obj } // ProtoToInstancePreprocessPassthroughRecipeStepsPreprocessUpdate converts a InstancePreprocessPassthroughRecipeStepsPreprocessUpdate resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsPreprocessUpdate(p *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsPreprocessUpdate) *alpha.InstancePreprocessPassthroughRecipeStepsPreprocessUpdate { if p == nil { return nil } obj := &alpha.InstancePreprocessPassthroughRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.StringOrNil(p.LatencySloBucketName), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), } return obj } // ProtoToInstancePreprocessPassthroughRecipeStepsRequestedTenantProject converts a InstancePreprocessPassthroughRecipeStepsRequestedTenantProject resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsRequestedTenantProject(p *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsRequestedTenantProject) *alpha.InstancePreprocessPassthroughRecipeStepsRequestedTenantProject { if p == nil { return nil } obj := &alpha.InstancePreprocessPassthroughRecipeStepsRequestedTenantProject{ Tag: dcl.StringOrNil(p.Tag), Folder: dcl.StringOrNil(p.Folder), Scope: ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsRequestedTenantProjectScopeEnum(p.GetScope()), } return obj } // ProtoToInstancePreprocessPassthroughRecipeStepsPermissionsInfo converts a InstancePreprocessPassthroughRecipeStepsPermissionsInfo resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfo(p *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfo) *alpha.InstancePreprocessPassthroughRecipeStepsPermissionsInfo { if p == nil { return nil } obj := &alpha.InstancePreprocessPassthroughRecipeStepsPermissionsInfo{ PolicyName: ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyName(p.GetPolicyName()), ResourcePath: dcl.StringOrNil(p.ResourcePath), ApiAttrs: ProtoToTier2AlphaInstanceGoogleprotobufstruct(p.GetApiAttrs()), PolicyNameMode: ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyNameModeEnum(p.GetPolicyNameMode()), Resource: ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoResource(p.GetResource()), } for _, r := range p.GetIamPermissions() { obj.IamPermissions = append(obj.IamPermissions, *ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoIamPermissions(r)) } return obj } // ProtoToInstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyName converts a InstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyName resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyName(p *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyName) *alpha.InstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyName { if p == nil { return nil } obj := &alpha.InstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyName{ Type: dcl.StringOrNil(p.Type), Id: dcl.StringOrNil(p.Id), Region: dcl.StringOrNil(p.Region), } return obj } // ProtoToInstancePreprocessPassthroughRecipeStepsPermissionsInfoIamPermissions converts a InstancePreprocessPassthroughRecipeStepsPermissionsInfoIamPermissions resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoIamPermissions(p *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoIamPermissions) *alpha.InstancePreprocessPassthroughRecipeStepsPermissionsInfoIamPermissions { if p == nil { return nil } obj := &alpha.InstancePreprocessPassthroughRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.StringOrNil(p.Permission), } return obj } // ProtoToInstancePreprocessPassthroughRecipeStepsPermissionsInfoResource converts a InstancePreprocessPassthroughRecipeStepsPermissionsInfoResource resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoResource(p *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoResource) *alpha.InstancePreprocessPassthroughRecipeStepsPermissionsInfoResource { if p == nil { return nil } obj := &alpha.InstancePreprocessPassthroughRecipeStepsPermissionsInfoResource{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), Service: dcl.StringOrNil(p.Service), } return obj } // ProtoToInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdate converts a InstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdate resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdate(p *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdate) *alpha.InstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdate { if p == nil { return nil } obj := &alpha.InstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p.GetKeyNotificationsInfo()), } return obj } // ProtoToInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo converts a InstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alpha.InstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if p == nil { return nil } obj := &alpha.InstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.Int64OrNil(p.DataVersion), Delegate: dcl.StringOrNil(p.Delegate), } for _, r := range p.GetKeyNotificationConfigs() { obj.KeyNotificationConfigs = append(obj.KeyNotificationConfigs, *ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(r)) } return obj } // ProtoToInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs converts a InstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(p *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alpha.InstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if p == nil { return nil } obj := &alpha.InstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.StringOrNil(p.KeyOrVersionName), Grant: dcl.StringOrNil(p.Grant), DelegatorGaiaId: dcl.Int64OrNil(p.DelegatorGaiaId), } return obj } // ProtoToInstancePreprocessReconcileRecipe converts a InstancePreprocessReconcileRecipe resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReconcileRecipe(p *alphapb.Tier2AlphaInstancePreprocessReconcileRecipe) *alpha.InstancePreprocessReconcileRecipe { if p == nil { return nil } obj := &alpha.InstancePreprocessReconcileRecipe{ HonorCancelRequest: dcl.Bool(p.HonorCancelRequest), IgnoreRecipeAfter: dcl.Int64OrNil(p.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.Float64OrNil(p.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.Bool(p.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.StringOrNil(p.GetReadonlyRecipeStartTime()), DelayToStoreResourcesInClhDbNanos: dcl.Int64OrNil(p.DelayToStoreResourcesInClhDbNanos), } for _, r := range p.GetSteps() { obj.Steps = append(obj.Steps, *ProtoToTier2AlphaInstancePreprocessReconcileRecipeSteps(r)) } for _, r := range p.GetResourceNamesStoredInClhWithDelay() { obj.ResourceNamesStoredInClhWithDelay = append(obj.ResourceNamesStoredInClhWithDelay, r) } return obj } // ProtoToInstancePreprocessReconcileRecipeSteps converts a InstancePreprocessReconcileRecipeSteps resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReconcileRecipeSteps(p *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeSteps) *alpha.InstancePreprocessReconcileRecipeSteps { if p == nil { return nil } obj := &alpha.InstancePreprocessReconcileRecipeSteps{ RelativeTime: dcl.Int64OrNil(p.RelativeTime), SleepDuration: dcl.Int64OrNil(p.SleepDuration), Action: ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsActionEnum(p.GetAction()), Status: ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsStatus(p.GetStatus()), ErrorSpace: dcl.StringOrNil(p.ErrorSpace), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), ResourceMetadataSize: dcl.Int64OrNil(p.ResourceMetadataSize), Description: dcl.StringOrNil(p.Description), UpdatedRepeatOperationDelaySec: dcl.Float64OrNil(p.UpdatedRepeatOperationDelaySec), PreprocessUpdate: ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsPreprocessUpdate(p.GetPreprocessUpdate()), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), RequestedTenantProject: ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsRequestedTenantProject(p.GetRequestedTenantProject()), KeyNotificationsUpdate: ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdate(p.GetKeyNotificationsUpdate()), ClhDataUpdateTime: dcl.StringOrNil(p.GetClhDataUpdateTime()), PublicErrorMessage: dcl.StringOrNil(p.PublicErrorMessage), } for _, r := range p.GetQuotaRequestDeltas() { obj.QuotaRequestDeltas = append(obj.QuotaRequestDeltas, *ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsQuotaRequestDeltas(r)) } for _, r := range p.GetPermissionsInfo() { obj.PermissionsInfo = append(obj.PermissionsInfo, *ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfo(r)) } return obj } // ProtoToInstancePreprocessReconcileRecipeStepsStatus converts a InstancePreprocessReconcileRecipeStepsStatus resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsStatus(p *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsStatus) *alpha.InstancePreprocessReconcileRecipeStepsStatus { if p == nil { return nil } obj := &alpha.InstancePreprocessReconcileRecipeStepsStatus{ Code: dcl.Int64OrNil(p.Code), Message: dcl.StringOrNil(p.Message), } for _, r := range p.GetDetails() { obj.Details = append(obj.Details, *ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsStatusDetails(r)) } return obj } // ProtoToInstancePreprocessReconcileRecipeStepsStatusDetails converts a InstancePreprocessReconcileRecipeStepsStatusDetails resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsStatusDetails(p *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsStatusDetails) *alpha.InstancePreprocessReconcileRecipeStepsStatusDetails { if p == nil { return nil } obj := &alpha.InstancePreprocessReconcileRecipeStepsStatusDetails{ TypeUrl: dcl.StringOrNil(p.TypeUrl), Value: dcl.StringOrNil(p.Value), } return obj } // ProtoToInstancePreprocessReconcileRecipeStepsQuotaRequestDeltas converts a InstancePreprocessReconcileRecipeStepsQuotaRequestDeltas resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsQuotaRequestDeltas(p *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsQuotaRequestDeltas) *alpha.InstancePreprocessReconcileRecipeStepsQuotaRequestDeltas { if p == nil { return nil } obj := &alpha.InstancePreprocessReconcileRecipeStepsQuotaRequestDeltas{ MetricName: dcl.StringOrNil(p.MetricName), Amount: dcl.Int64OrNil(p.Amount), QuotaLocationName: dcl.StringOrNil(p.QuotaLocationName), } return obj } // ProtoToInstancePreprocessReconcileRecipeStepsPreprocessUpdate converts a InstancePreprocessReconcileRecipeStepsPreprocessUpdate resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsPreprocessUpdate(p *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsPreprocessUpdate) *alpha.InstancePreprocessReconcileRecipeStepsPreprocessUpdate { if p == nil { return nil } obj := &alpha.InstancePreprocessReconcileRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.StringOrNil(p.LatencySloBucketName), PublicOperationMetadata: dcl.StringOrNil(p.PublicOperationMetadata), } return obj } // ProtoToInstancePreprocessReconcileRecipeStepsRequestedTenantProject converts a InstancePreprocessReconcileRecipeStepsRequestedTenantProject resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsRequestedTenantProject(p *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsRequestedTenantProject) *alpha.InstancePreprocessReconcileRecipeStepsRequestedTenantProject { if p == nil { return nil } obj := &alpha.InstancePreprocessReconcileRecipeStepsRequestedTenantProject{ Tag: dcl.StringOrNil(p.Tag), Folder: dcl.StringOrNil(p.Folder), Scope: ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsRequestedTenantProjectScopeEnum(p.GetScope()), } return obj } // ProtoToInstancePreprocessReconcileRecipeStepsPermissionsInfo converts a InstancePreprocessReconcileRecipeStepsPermissionsInfo resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfo(p *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfo) *alpha.InstancePreprocessReconcileRecipeStepsPermissionsInfo { if p == nil { return nil } obj := &alpha.InstancePreprocessReconcileRecipeStepsPermissionsInfo{ PolicyName: ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyName(p.GetPolicyName()), ResourcePath: dcl.StringOrNil(p.ResourcePath), ApiAttrs: ProtoToTier2AlphaInstanceGoogleprotobufstruct(p.GetApiAttrs()), PolicyNameMode: ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum(p.GetPolicyNameMode()), Resource: ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoResource(p.GetResource()), } for _, r := range p.GetIamPermissions() { obj.IamPermissions = append(obj.IamPermissions, *ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoIamPermissions(r)) } return obj } // ProtoToInstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyName converts a InstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyName resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyName(p *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyName) *alpha.InstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyName { if p == nil { return nil } obj := &alpha.InstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyName{ Type: dcl.StringOrNil(p.Type), Id: dcl.StringOrNil(p.Id), Region: dcl.StringOrNil(p.Region), } return obj } // ProtoToInstancePreprocessReconcileRecipeStepsPermissionsInfoIamPermissions converts a InstancePreprocessReconcileRecipeStepsPermissionsInfoIamPermissions resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoIamPermissions(p *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoIamPermissions) *alpha.InstancePreprocessReconcileRecipeStepsPermissionsInfoIamPermissions { if p == nil { return nil } obj := &alpha.InstancePreprocessReconcileRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.StringOrNil(p.Permission), } return obj } // ProtoToInstancePreprocessReconcileRecipeStepsPermissionsInfoResource converts a InstancePreprocessReconcileRecipeStepsPermissionsInfoResource resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoResource(p *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoResource) *alpha.InstancePreprocessReconcileRecipeStepsPermissionsInfoResource { if p == nil { return nil } obj := &alpha.InstancePreprocessReconcileRecipeStepsPermissionsInfoResource{ Name: dcl.StringOrNil(p.Name), Type: dcl.StringOrNil(p.Type), Service: dcl.StringOrNil(p.Service), } return obj } // ProtoToInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdate converts a InstancePreprocessReconcileRecipeStepsKeyNotificationsUpdate resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdate(p *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdate) *alpha.InstancePreprocessReconcileRecipeStepsKeyNotificationsUpdate { if p == nil { return nil } obj := &alpha.InstancePreprocessReconcileRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p.GetKeyNotificationsInfo()), } return obj } // ProtoToInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo converts a InstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo(p *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alpha.InstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if p == nil { return nil } obj := &alpha.InstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.Int64OrNil(p.DataVersion), Delegate: dcl.StringOrNil(p.Delegate), } for _, r := range p.GetKeyNotificationConfigs() { obj.KeyNotificationConfigs = append(obj.KeyNotificationConfigs, *ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(r)) } return obj } // ProtoToInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs converts a InstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource from its proto representation. func ProtoToTier2AlphaInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs(p *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alpha.InstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if p == nil { return nil } obj := &alpha.InstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.StringOrNil(p.KeyOrVersionName), Grant: dcl.StringOrNil(p.Grant), DelegatorGaiaId: dcl.Int64OrNil(p.DelegatorGaiaId), } return obj } // ProtoToInstanceHistory converts a InstanceHistory resource from its proto representation. func ProtoToTier2AlphaInstanceHistory(p *alphapb.Tier2AlphaInstanceHistory) *alpha.InstanceHistory { if p == nil { return nil } obj := &alpha.InstanceHistory{ Timestamp: dcl.StringOrNil(p.GetTimestamp()), OperationHandle: dcl.StringOrNil(p.OperationHandle), Description: dcl.StringOrNil(p.Description), StepIndex: dcl.Int64OrNil(p.StepIndex), TenantProjectNumber: dcl.Int64OrNil(p.TenantProjectNumber), TenantProjectId: dcl.StringOrNil(p.TenantProjectId), P4ServiceAccount: dcl.StringOrNil(p.P4ServiceAccount), } return obj } // ProtoToInstance converts a Instance resource from its proto representation. func ProtoToInstance(p *alphapb.Tier2AlphaInstance) *alpha.Instance { obj := &alpha.Instance{ Name: dcl.StringOrNil(p.Name), DisplayName: dcl.StringOrNil(p.DisplayName), Zone: dcl.StringOrNil(p.Zone), AlternativeZone: dcl.StringOrNil(p.AlternativeZone), Sku: ProtoToTier2AlphaInstanceSku(p.GetSku()), AuthorizedNetworkId: dcl.StringOrNil(p.AuthorizedNetworkId), ReservedIPRange: dcl.StringOrNil(p.ReservedIpRange), Host: dcl.StringOrNil(p.Host), Port: dcl.Int64OrNil(p.Port), CurrentZone: dcl.StringOrNil(p.CurrentZone), CreateTime: dcl.StringOrNil(p.GetCreateTime()), State: ProtoToTier2AlphaInstanceStateEnum(p.GetState()), StatusMessage: dcl.StringOrNil(p.StatusMessage), UpdateTime: dcl.StringOrNil(p.GetUpdateTime()), MutateUserId: dcl.Int64OrNil(p.MutateUserId), ReadUserId: dcl.Int64OrNil(p.ReadUserId), PreprocessCreateRecipe: ProtoToTier2AlphaInstancePreprocessCreateRecipe(p.GetPreprocessCreateRecipe()), CreateRecipe: ProtoToTier2AlphaInstanceCreateRecipe(p.GetCreateRecipe()), DeleteRecipe: ProtoToTier2AlphaInstanceDeleteRecipe(p.GetDeleteRecipe()), UpdateRecipe: ProtoToTier2AlphaInstanceUpdateRecipe(p.GetUpdateRecipe()), PreprocessResetRecipe: ProtoToTier2AlphaInstancePreprocessResetRecipe(p.GetPreprocessResetRecipe()), ResetRecipe: ProtoToTier2AlphaInstanceResetRecipe(p.GetResetRecipe()), PreprocessRepairRecipe: ProtoToTier2AlphaInstancePreprocessRepairRecipe(p.GetPreprocessRepairRecipe()), RepairRecipe: ProtoToTier2AlphaInstanceRepairRecipe(p.GetRepairRecipe()), PreprocessDeleteRecipe: ProtoToTier2AlphaInstancePreprocessDeleteRecipe(p.GetPreprocessDeleteRecipe()), PreprocessUpdateRecipe: ProtoToTier2AlphaInstancePreprocessUpdateRecipe(p.GetPreprocessUpdateRecipe()), PreprocessFreezeRecipe: ProtoToTier2AlphaInstancePreprocessFreezeRecipe(p.GetPreprocessFreezeRecipe()), FreezeRecipe: ProtoToTier2AlphaInstanceFreezeRecipe(p.GetFreezeRecipe()), PreprocessUnfreezeRecipe: ProtoToTier2AlphaInstancePreprocessUnfreezeRecipe(p.GetPreprocessUnfreezeRecipe()), UnfreezeRecipe: ProtoToTier2AlphaInstanceUnfreezeRecipe(p.GetUnfreezeRecipe()), PreprocessReportInstanceHealthRecipe: ProtoToTier2AlphaInstancePreprocessReportInstanceHealthRecipe(p.GetPreprocessReportInstanceHealthRecipe()), ReportInstanceHealthRecipe: ProtoToTier2AlphaInstanceReportInstanceHealthRecipe(p.GetReportInstanceHealthRecipe()), PreprocessGetRecipe: ProtoToTier2AlphaInstancePreprocessGetRecipe(p.GetPreprocessGetRecipe()), NotifyKeyAvailableRecipe: ProtoToTier2AlphaInstanceNotifyKeyAvailableRecipe(p.GetNotifyKeyAvailableRecipe()), NotifyKeyUnavailableRecipe: ProtoToTier2AlphaInstanceNotifyKeyUnavailableRecipe(p.GetNotifyKeyUnavailableRecipe()), ReadonlyRecipe: ProtoToTier2AlphaInstanceReadonlyRecipe(p.GetReadonlyRecipe()), ReconcileRecipe: ProtoToTier2AlphaInstanceReconcileRecipe(p.GetReconcileRecipe()), PreprocessPassthroughRecipe: ProtoToTier2AlphaInstancePreprocessPassthroughRecipe(p.GetPreprocessPassthroughRecipe()), PreprocessReconcileRecipe: ProtoToTier2AlphaInstancePreprocessReconcileRecipe(p.GetPreprocessReconcileRecipe()), EnableCallHistory: dcl.Bool(p.EnableCallHistory), PublicResourceViewOverride: dcl.StringOrNil(p.PublicResourceViewOverride), ExtraInfo: dcl.StringOrNil(p.ExtraInfo), Uid: dcl.StringOrNil(p.Uid), Etag: dcl.StringOrNil(p.Etag), Project: dcl.StringOrNil(p.Project), Location: dcl.StringOrNil(p.Location), } for _, r := range p.GetReferences() { obj.References = append(obj.References, *ProtoToTier2AlphaInstanceReferences(r)) } for _, r := range p.GetEncryptionKeys() { obj.EncryptionKeys = append(obj.EncryptionKeys, *ProtoToTier2AlphaInstanceEncryptionKeys(r)) } for _, r := range p.GetHistory() { obj.History = append(obj.History, *ProtoToTier2AlphaInstanceHistory(r)) } return obj } // InstanceSkuTierEnumToProto converts a InstanceSkuTierEnum enum to its proto representation. func Tier2AlphaInstanceSkuTierEnumToProto(e *alpha.InstanceSkuTierEnum) alphapb.Tier2AlphaInstanceSkuTierEnum { if e == nil { return alphapb.Tier2AlphaInstanceSkuTierEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceSkuTierEnum_value["InstanceSkuTierEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceSkuTierEnum(v) } return alphapb.Tier2AlphaInstanceSkuTierEnum(0) } // InstanceSkuSizeEnumToProto converts a InstanceSkuSizeEnum enum to its proto representation. func Tier2AlphaInstanceSkuSizeEnumToProto(e *alpha.InstanceSkuSizeEnum) alphapb.Tier2AlphaInstanceSkuSizeEnum { if e == nil { return alphapb.Tier2AlphaInstanceSkuSizeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceSkuSizeEnum_value["InstanceSkuSizeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceSkuSizeEnum(v) } return alphapb.Tier2AlphaInstanceSkuSizeEnum(0) } // InstanceStateEnumToProto converts a InstanceStateEnum enum to its proto representation. func Tier2AlphaInstanceStateEnumToProto(e *alpha.InstanceStateEnum) alphapb.Tier2AlphaInstanceStateEnum { if e == nil { return alphapb.Tier2AlphaInstanceStateEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceStateEnum_value["InstanceStateEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceStateEnum(v) } return alphapb.Tier2AlphaInstanceStateEnum(0) } // InstanceEncryptionKeysKeyStateAvailabilityKeyVersionStateEnumToProto converts a InstanceEncryptionKeysKeyStateAvailabilityKeyVersionStateEnum enum to its proto representation. func Tier2AlphaInstanceEncryptionKeysKeyStateAvailabilityKeyVersionStateEnumToProto(e *alpha.InstanceEncryptionKeysKeyStateAvailabilityKeyVersionStateEnum) alphapb.Tier2AlphaInstanceEncryptionKeysKeyStateAvailabilityKeyVersionStateEnum { if e == nil { return alphapb.Tier2AlphaInstanceEncryptionKeysKeyStateAvailabilityKeyVersionStateEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceEncryptionKeysKeyStateAvailabilityKeyVersionStateEnum_value["InstanceEncryptionKeysKeyStateAvailabilityKeyVersionStateEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceEncryptionKeysKeyStateAvailabilityKeyVersionStateEnum(v) } return alphapb.Tier2AlphaInstanceEncryptionKeysKeyStateAvailabilityKeyVersionStateEnum(0) } // InstancePreprocessCreateRecipeStepsActionEnumToProto converts a InstancePreprocessCreateRecipeStepsActionEnum enum to its proto representation. func Tier2AlphaInstancePreprocessCreateRecipeStepsActionEnumToProto(e *alpha.InstancePreprocessCreateRecipeStepsActionEnum) alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsActionEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsActionEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsActionEnum_value["InstancePreprocessCreateRecipeStepsActionEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsActionEnum(v) } return alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsActionEnum(0) } // InstancePreprocessCreateRecipeStepsRequestedTenantProjectScopeEnumToProto converts a InstancePreprocessCreateRecipeStepsRequestedTenantProjectScopeEnum enum to its proto representation. func Tier2AlphaInstancePreprocessCreateRecipeStepsRequestedTenantProjectScopeEnumToProto(e *alpha.InstancePreprocessCreateRecipeStepsRequestedTenantProjectScopeEnum) alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsRequestedTenantProjectScopeEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsRequestedTenantProjectScopeEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsRequestedTenantProjectScopeEnum_value["InstancePreprocessCreateRecipeStepsRequestedTenantProjectScopeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsRequestedTenantProjectScopeEnum(v) } return alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsRequestedTenantProjectScopeEnum(0) } // InstancePreprocessCreateRecipeStepsPermissionsInfoPolicyNameModeEnumToProto converts a InstancePreprocessCreateRecipeStepsPermissionsInfoPolicyNameModeEnum enum to its proto representation. func Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(e *alpha.InstancePreprocessCreateRecipeStepsPermissionsInfoPolicyNameModeEnum) alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoPolicyNameModeEnum_value["InstancePreprocessCreateRecipeStepsPermissionsInfoPolicyNameModeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoPolicyNameModeEnum(v) } return alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } // InstanceCreateRecipeStepsActionEnumToProto converts a InstanceCreateRecipeStepsActionEnum enum to its proto representation. func Tier2AlphaInstanceCreateRecipeStepsActionEnumToProto(e *alpha.InstanceCreateRecipeStepsActionEnum) alphapb.Tier2AlphaInstanceCreateRecipeStepsActionEnum { if e == nil { return alphapb.Tier2AlphaInstanceCreateRecipeStepsActionEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceCreateRecipeStepsActionEnum_value["InstanceCreateRecipeStepsActionEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceCreateRecipeStepsActionEnum(v) } return alphapb.Tier2AlphaInstanceCreateRecipeStepsActionEnum(0) } // InstanceCreateRecipeStepsRequestedTenantProjectScopeEnumToProto converts a InstanceCreateRecipeStepsRequestedTenantProjectScopeEnum enum to its proto representation. func Tier2AlphaInstanceCreateRecipeStepsRequestedTenantProjectScopeEnumToProto(e *alpha.InstanceCreateRecipeStepsRequestedTenantProjectScopeEnum) alphapb.Tier2AlphaInstanceCreateRecipeStepsRequestedTenantProjectScopeEnum { if e == nil { return alphapb.Tier2AlphaInstanceCreateRecipeStepsRequestedTenantProjectScopeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceCreateRecipeStepsRequestedTenantProjectScopeEnum_value["InstanceCreateRecipeStepsRequestedTenantProjectScopeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceCreateRecipeStepsRequestedTenantProjectScopeEnum(v) } return alphapb.Tier2AlphaInstanceCreateRecipeStepsRequestedTenantProjectScopeEnum(0) } // InstanceCreateRecipeStepsPermissionsInfoPolicyNameModeEnumToProto converts a InstanceCreateRecipeStepsPermissionsInfoPolicyNameModeEnum enum to its proto representation. func Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(e *alpha.InstanceCreateRecipeStepsPermissionsInfoPolicyNameModeEnum) alphapb.Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == nil { return alphapb.Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoPolicyNameModeEnum_value["InstanceCreateRecipeStepsPermissionsInfoPolicyNameModeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoPolicyNameModeEnum(v) } return alphapb.Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } // InstanceDeleteRecipeStepsActionEnumToProto converts a InstanceDeleteRecipeStepsActionEnum enum to its proto representation. func Tier2AlphaInstanceDeleteRecipeStepsActionEnumToProto(e *alpha.InstanceDeleteRecipeStepsActionEnum) alphapb.Tier2AlphaInstanceDeleteRecipeStepsActionEnum { if e == nil { return alphapb.Tier2AlphaInstanceDeleteRecipeStepsActionEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceDeleteRecipeStepsActionEnum_value["InstanceDeleteRecipeStepsActionEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceDeleteRecipeStepsActionEnum(v) } return alphapb.Tier2AlphaInstanceDeleteRecipeStepsActionEnum(0) } // InstanceDeleteRecipeStepsRequestedTenantProjectScopeEnumToProto converts a InstanceDeleteRecipeStepsRequestedTenantProjectScopeEnum enum to its proto representation. func Tier2AlphaInstanceDeleteRecipeStepsRequestedTenantProjectScopeEnumToProto(e *alpha.InstanceDeleteRecipeStepsRequestedTenantProjectScopeEnum) alphapb.Tier2AlphaInstanceDeleteRecipeStepsRequestedTenantProjectScopeEnum { if e == nil { return alphapb.Tier2AlphaInstanceDeleteRecipeStepsRequestedTenantProjectScopeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceDeleteRecipeStepsRequestedTenantProjectScopeEnum_value["InstanceDeleteRecipeStepsRequestedTenantProjectScopeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceDeleteRecipeStepsRequestedTenantProjectScopeEnum(v) } return alphapb.Tier2AlphaInstanceDeleteRecipeStepsRequestedTenantProjectScopeEnum(0) } // InstanceDeleteRecipeStepsPermissionsInfoPolicyNameModeEnumToProto converts a InstanceDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum enum to its proto representation. func Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(e *alpha.InstanceDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum) alphapb.Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == nil { return alphapb.Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum_value["InstanceDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum(v) } return alphapb.Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } // InstanceUpdateRecipeStepsActionEnumToProto converts a InstanceUpdateRecipeStepsActionEnum enum to its proto representation. func Tier2AlphaInstanceUpdateRecipeStepsActionEnumToProto(e *alpha.InstanceUpdateRecipeStepsActionEnum) alphapb.Tier2AlphaInstanceUpdateRecipeStepsActionEnum { if e == nil { return alphapb.Tier2AlphaInstanceUpdateRecipeStepsActionEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceUpdateRecipeStepsActionEnum_value["InstanceUpdateRecipeStepsActionEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceUpdateRecipeStepsActionEnum(v) } return alphapb.Tier2AlphaInstanceUpdateRecipeStepsActionEnum(0) } // InstanceUpdateRecipeStepsRequestedTenantProjectScopeEnumToProto converts a InstanceUpdateRecipeStepsRequestedTenantProjectScopeEnum enum to its proto representation. func Tier2AlphaInstanceUpdateRecipeStepsRequestedTenantProjectScopeEnumToProto(e *alpha.InstanceUpdateRecipeStepsRequestedTenantProjectScopeEnum) alphapb.Tier2AlphaInstanceUpdateRecipeStepsRequestedTenantProjectScopeEnum { if e == nil { return alphapb.Tier2AlphaInstanceUpdateRecipeStepsRequestedTenantProjectScopeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceUpdateRecipeStepsRequestedTenantProjectScopeEnum_value["InstanceUpdateRecipeStepsRequestedTenantProjectScopeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceUpdateRecipeStepsRequestedTenantProjectScopeEnum(v) } return alphapb.Tier2AlphaInstanceUpdateRecipeStepsRequestedTenantProjectScopeEnum(0) } // InstanceUpdateRecipeStepsPermissionsInfoPolicyNameModeEnumToProto converts a InstanceUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum enum to its proto representation. func Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(e *alpha.InstanceUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum) alphapb.Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == nil { return alphapb.Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum_value["InstanceUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum(v) } return alphapb.Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } // InstancePreprocessResetRecipeStepsActionEnumToProto converts a InstancePreprocessResetRecipeStepsActionEnum enum to its proto representation. func Tier2AlphaInstancePreprocessResetRecipeStepsActionEnumToProto(e *alpha.InstancePreprocessResetRecipeStepsActionEnum) alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsActionEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsActionEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsActionEnum_value["InstancePreprocessResetRecipeStepsActionEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsActionEnum(v) } return alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsActionEnum(0) } // InstancePreprocessResetRecipeStepsRequestedTenantProjectScopeEnumToProto converts a InstancePreprocessResetRecipeStepsRequestedTenantProjectScopeEnum enum to its proto representation. func Tier2AlphaInstancePreprocessResetRecipeStepsRequestedTenantProjectScopeEnumToProto(e *alpha.InstancePreprocessResetRecipeStepsRequestedTenantProjectScopeEnum) alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsRequestedTenantProjectScopeEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsRequestedTenantProjectScopeEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsRequestedTenantProjectScopeEnum_value["InstancePreprocessResetRecipeStepsRequestedTenantProjectScopeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsRequestedTenantProjectScopeEnum(v) } return alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsRequestedTenantProjectScopeEnum(0) } // InstancePreprocessResetRecipeStepsPermissionsInfoPolicyNameModeEnumToProto converts a InstancePreprocessResetRecipeStepsPermissionsInfoPolicyNameModeEnum enum to its proto representation. func Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(e *alpha.InstancePreprocessResetRecipeStepsPermissionsInfoPolicyNameModeEnum) alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoPolicyNameModeEnum_value["InstancePreprocessResetRecipeStepsPermissionsInfoPolicyNameModeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoPolicyNameModeEnum(v) } return alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } // InstanceResetRecipeStepsActionEnumToProto converts a InstanceResetRecipeStepsActionEnum enum to its proto representation. func Tier2AlphaInstanceResetRecipeStepsActionEnumToProto(e *alpha.InstanceResetRecipeStepsActionEnum) alphapb.Tier2AlphaInstanceResetRecipeStepsActionEnum { if e == nil { return alphapb.Tier2AlphaInstanceResetRecipeStepsActionEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceResetRecipeStepsActionEnum_value["InstanceResetRecipeStepsActionEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceResetRecipeStepsActionEnum(v) } return alphapb.Tier2AlphaInstanceResetRecipeStepsActionEnum(0) } // InstanceResetRecipeStepsRequestedTenantProjectScopeEnumToProto converts a InstanceResetRecipeStepsRequestedTenantProjectScopeEnum enum to its proto representation. func Tier2AlphaInstanceResetRecipeStepsRequestedTenantProjectScopeEnumToProto(e *alpha.InstanceResetRecipeStepsRequestedTenantProjectScopeEnum) alphapb.Tier2AlphaInstanceResetRecipeStepsRequestedTenantProjectScopeEnum { if e == nil { return alphapb.Tier2AlphaInstanceResetRecipeStepsRequestedTenantProjectScopeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceResetRecipeStepsRequestedTenantProjectScopeEnum_value["InstanceResetRecipeStepsRequestedTenantProjectScopeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceResetRecipeStepsRequestedTenantProjectScopeEnum(v) } return alphapb.Tier2AlphaInstanceResetRecipeStepsRequestedTenantProjectScopeEnum(0) } // InstanceResetRecipeStepsPermissionsInfoPolicyNameModeEnumToProto converts a InstanceResetRecipeStepsPermissionsInfoPolicyNameModeEnum enum to its proto representation. func Tier2AlphaInstanceResetRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(e *alpha.InstanceResetRecipeStepsPermissionsInfoPolicyNameModeEnum) alphapb.Tier2AlphaInstanceResetRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == nil { return alphapb.Tier2AlphaInstanceResetRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceResetRecipeStepsPermissionsInfoPolicyNameModeEnum_value["InstanceResetRecipeStepsPermissionsInfoPolicyNameModeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceResetRecipeStepsPermissionsInfoPolicyNameModeEnum(v) } return alphapb.Tier2AlphaInstanceResetRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } // InstancePreprocessRepairRecipeStepsActionEnumToProto converts a InstancePreprocessRepairRecipeStepsActionEnum enum to its proto representation. func Tier2AlphaInstancePreprocessRepairRecipeStepsActionEnumToProto(e *alpha.InstancePreprocessRepairRecipeStepsActionEnum) alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsActionEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsActionEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsActionEnum_value["InstancePreprocessRepairRecipeStepsActionEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsActionEnum(v) } return alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsActionEnum(0) } // InstancePreprocessRepairRecipeStepsRequestedTenantProjectScopeEnumToProto converts a InstancePreprocessRepairRecipeStepsRequestedTenantProjectScopeEnum enum to its proto representation. func Tier2AlphaInstancePreprocessRepairRecipeStepsRequestedTenantProjectScopeEnumToProto(e *alpha.InstancePreprocessRepairRecipeStepsRequestedTenantProjectScopeEnum) alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsRequestedTenantProjectScopeEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsRequestedTenantProjectScopeEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsRequestedTenantProjectScopeEnum_value["InstancePreprocessRepairRecipeStepsRequestedTenantProjectScopeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsRequestedTenantProjectScopeEnum(v) } return alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsRequestedTenantProjectScopeEnum(0) } // InstancePreprocessRepairRecipeStepsPermissionsInfoPolicyNameModeEnumToProto converts a InstancePreprocessRepairRecipeStepsPermissionsInfoPolicyNameModeEnum enum to its proto representation. func Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(e *alpha.InstancePreprocessRepairRecipeStepsPermissionsInfoPolicyNameModeEnum) alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoPolicyNameModeEnum_value["InstancePreprocessRepairRecipeStepsPermissionsInfoPolicyNameModeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoPolicyNameModeEnum(v) } return alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } // InstanceRepairRecipeStepsActionEnumToProto converts a InstanceRepairRecipeStepsActionEnum enum to its proto representation. func Tier2AlphaInstanceRepairRecipeStepsActionEnumToProto(e *alpha.InstanceRepairRecipeStepsActionEnum) alphapb.Tier2AlphaInstanceRepairRecipeStepsActionEnum { if e == nil { return alphapb.Tier2AlphaInstanceRepairRecipeStepsActionEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceRepairRecipeStepsActionEnum_value["InstanceRepairRecipeStepsActionEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceRepairRecipeStepsActionEnum(v) } return alphapb.Tier2AlphaInstanceRepairRecipeStepsActionEnum(0) } // InstanceRepairRecipeStepsRequestedTenantProjectScopeEnumToProto converts a InstanceRepairRecipeStepsRequestedTenantProjectScopeEnum enum to its proto representation. func Tier2AlphaInstanceRepairRecipeStepsRequestedTenantProjectScopeEnumToProto(e *alpha.InstanceRepairRecipeStepsRequestedTenantProjectScopeEnum) alphapb.Tier2AlphaInstanceRepairRecipeStepsRequestedTenantProjectScopeEnum { if e == nil { return alphapb.Tier2AlphaInstanceRepairRecipeStepsRequestedTenantProjectScopeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceRepairRecipeStepsRequestedTenantProjectScopeEnum_value["InstanceRepairRecipeStepsRequestedTenantProjectScopeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceRepairRecipeStepsRequestedTenantProjectScopeEnum(v) } return alphapb.Tier2AlphaInstanceRepairRecipeStepsRequestedTenantProjectScopeEnum(0) } // InstanceRepairRecipeStepsPermissionsInfoPolicyNameModeEnumToProto converts a InstanceRepairRecipeStepsPermissionsInfoPolicyNameModeEnum enum to its proto representation. func Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(e *alpha.InstanceRepairRecipeStepsPermissionsInfoPolicyNameModeEnum) alphapb.Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == nil { return alphapb.Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoPolicyNameModeEnum_value["InstanceRepairRecipeStepsPermissionsInfoPolicyNameModeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoPolicyNameModeEnum(v) } return alphapb.Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } // InstancePreprocessDeleteRecipeStepsActionEnumToProto converts a InstancePreprocessDeleteRecipeStepsActionEnum enum to its proto representation. func Tier2AlphaInstancePreprocessDeleteRecipeStepsActionEnumToProto(e *alpha.InstancePreprocessDeleteRecipeStepsActionEnum) alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsActionEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsActionEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsActionEnum_value["InstancePreprocessDeleteRecipeStepsActionEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsActionEnum(v) } return alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsActionEnum(0) } // InstancePreprocessDeleteRecipeStepsRequestedTenantProjectScopeEnumToProto converts a InstancePreprocessDeleteRecipeStepsRequestedTenantProjectScopeEnum enum to its proto representation. func Tier2AlphaInstancePreprocessDeleteRecipeStepsRequestedTenantProjectScopeEnumToProto(e *alpha.InstancePreprocessDeleteRecipeStepsRequestedTenantProjectScopeEnum) alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsRequestedTenantProjectScopeEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsRequestedTenantProjectScopeEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsRequestedTenantProjectScopeEnum_value["InstancePreprocessDeleteRecipeStepsRequestedTenantProjectScopeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsRequestedTenantProjectScopeEnum(v) } return alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsRequestedTenantProjectScopeEnum(0) } // InstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyNameModeEnumToProto converts a InstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum enum to its proto representation. func Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(e *alpha.InstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum) alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum_value["InstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum(v) } return alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } // InstancePreprocessUpdateRecipeStepsActionEnumToProto converts a InstancePreprocessUpdateRecipeStepsActionEnum enum to its proto representation. func Tier2AlphaInstancePreprocessUpdateRecipeStepsActionEnumToProto(e *alpha.InstancePreprocessUpdateRecipeStepsActionEnum) alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsActionEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsActionEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsActionEnum_value["InstancePreprocessUpdateRecipeStepsActionEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsActionEnum(v) } return alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsActionEnum(0) } // InstancePreprocessUpdateRecipeStepsRequestedTenantProjectScopeEnumToProto converts a InstancePreprocessUpdateRecipeStepsRequestedTenantProjectScopeEnum enum to its proto representation. func Tier2AlphaInstancePreprocessUpdateRecipeStepsRequestedTenantProjectScopeEnumToProto(e *alpha.InstancePreprocessUpdateRecipeStepsRequestedTenantProjectScopeEnum) alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsRequestedTenantProjectScopeEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsRequestedTenantProjectScopeEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsRequestedTenantProjectScopeEnum_value["InstancePreprocessUpdateRecipeStepsRequestedTenantProjectScopeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsRequestedTenantProjectScopeEnum(v) } return alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsRequestedTenantProjectScopeEnum(0) } // InstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyNameModeEnumToProto converts a InstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum enum to its proto representation. func Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(e *alpha.InstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum) alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum_value["InstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum(v) } return alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } // InstancePreprocessFreezeRecipeStepsActionEnumToProto converts a InstancePreprocessFreezeRecipeStepsActionEnum enum to its proto representation. func Tier2AlphaInstancePreprocessFreezeRecipeStepsActionEnumToProto(e *alpha.InstancePreprocessFreezeRecipeStepsActionEnum) alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsActionEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsActionEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsActionEnum_value["InstancePreprocessFreezeRecipeStepsActionEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsActionEnum(v) } return alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsActionEnum(0) } // InstancePreprocessFreezeRecipeStepsRequestedTenantProjectScopeEnumToProto converts a InstancePreprocessFreezeRecipeStepsRequestedTenantProjectScopeEnum enum to its proto representation. func Tier2AlphaInstancePreprocessFreezeRecipeStepsRequestedTenantProjectScopeEnumToProto(e *alpha.InstancePreprocessFreezeRecipeStepsRequestedTenantProjectScopeEnum) alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsRequestedTenantProjectScopeEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsRequestedTenantProjectScopeEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsRequestedTenantProjectScopeEnum_value["InstancePreprocessFreezeRecipeStepsRequestedTenantProjectScopeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsRequestedTenantProjectScopeEnum(v) } return alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsRequestedTenantProjectScopeEnum(0) } // InstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyNameModeEnumToProto converts a InstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum enum to its proto representation. func Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(e *alpha.InstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum) alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum_value["InstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(v) } return alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } // InstanceFreezeRecipeStepsActionEnumToProto converts a InstanceFreezeRecipeStepsActionEnum enum to its proto representation. func Tier2AlphaInstanceFreezeRecipeStepsActionEnumToProto(e *alpha.InstanceFreezeRecipeStepsActionEnum) alphapb.Tier2AlphaInstanceFreezeRecipeStepsActionEnum { if e == nil { return alphapb.Tier2AlphaInstanceFreezeRecipeStepsActionEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceFreezeRecipeStepsActionEnum_value["InstanceFreezeRecipeStepsActionEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceFreezeRecipeStepsActionEnum(v) } return alphapb.Tier2AlphaInstanceFreezeRecipeStepsActionEnum(0) } // InstanceFreezeRecipeStepsRequestedTenantProjectScopeEnumToProto converts a InstanceFreezeRecipeStepsRequestedTenantProjectScopeEnum enum to its proto representation. func Tier2AlphaInstanceFreezeRecipeStepsRequestedTenantProjectScopeEnumToProto(e *alpha.InstanceFreezeRecipeStepsRequestedTenantProjectScopeEnum) alphapb.Tier2AlphaInstanceFreezeRecipeStepsRequestedTenantProjectScopeEnum { if e == nil { return alphapb.Tier2AlphaInstanceFreezeRecipeStepsRequestedTenantProjectScopeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceFreezeRecipeStepsRequestedTenantProjectScopeEnum_value["InstanceFreezeRecipeStepsRequestedTenantProjectScopeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceFreezeRecipeStepsRequestedTenantProjectScopeEnum(v) } return alphapb.Tier2AlphaInstanceFreezeRecipeStepsRequestedTenantProjectScopeEnum(0) } // InstanceFreezeRecipeStepsPermissionsInfoPolicyNameModeEnumToProto converts a InstanceFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum enum to its proto representation. func Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(e *alpha.InstanceFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum) alphapb.Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == nil { return alphapb.Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum_value["InstanceFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(v) } return alphapb.Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } // InstancePreprocessUnfreezeRecipeStepsActionEnumToProto converts a InstancePreprocessUnfreezeRecipeStepsActionEnum enum to its proto representation. func Tier2AlphaInstancePreprocessUnfreezeRecipeStepsActionEnumToProto(e *alpha.InstancePreprocessUnfreezeRecipeStepsActionEnum) alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsActionEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsActionEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsActionEnum_value["InstancePreprocessUnfreezeRecipeStepsActionEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsActionEnum(v) } return alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsActionEnum(0) } // InstancePreprocessUnfreezeRecipeStepsRequestedTenantProjectScopeEnumToProto converts a InstancePreprocessUnfreezeRecipeStepsRequestedTenantProjectScopeEnum enum to its proto representation. func Tier2AlphaInstancePreprocessUnfreezeRecipeStepsRequestedTenantProjectScopeEnumToProto(e *alpha.InstancePreprocessUnfreezeRecipeStepsRequestedTenantProjectScopeEnum) alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsRequestedTenantProjectScopeEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsRequestedTenantProjectScopeEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsRequestedTenantProjectScopeEnum_value["InstancePreprocessUnfreezeRecipeStepsRequestedTenantProjectScopeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsRequestedTenantProjectScopeEnum(v) } return alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsRequestedTenantProjectScopeEnum(0) } // InstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnumToProto converts a InstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum enum to its proto representation. func Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(e *alpha.InstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum) alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum_value["InstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(v) } return alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } // InstanceUnfreezeRecipeStepsActionEnumToProto converts a InstanceUnfreezeRecipeStepsActionEnum enum to its proto representation. func Tier2AlphaInstanceUnfreezeRecipeStepsActionEnumToProto(e *alpha.InstanceUnfreezeRecipeStepsActionEnum) alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsActionEnum { if e == nil { return alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsActionEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsActionEnum_value["InstanceUnfreezeRecipeStepsActionEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsActionEnum(v) } return alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsActionEnum(0) } // InstanceUnfreezeRecipeStepsRequestedTenantProjectScopeEnumToProto converts a InstanceUnfreezeRecipeStepsRequestedTenantProjectScopeEnum enum to its proto representation. func Tier2AlphaInstanceUnfreezeRecipeStepsRequestedTenantProjectScopeEnumToProto(e *alpha.InstanceUnfreezeRecipeStepsRequestedTenantProjectScopeEnum) alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsRequestedTenantProjectScopeEnum { if e == nil { return alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsRequestedTenantProjectScopeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsRequestedTenantProjectScopeEnum_value["InstanceUnfreezeRecipeStepsRequestedTenantProjectScopeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsRequestedTenantProjectScopeEnum(v) } return alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsRequestedTenantProjectScopeEnum(0) } // InstanceUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnumToProto converts a InstanceUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum enum to its proto representation. func Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(e *alpha.InstanceUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum) alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == nil { return alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum_value["InstanceUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(v) } return alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } // InstancePreprocessReportInstanceHealthRecipeStepsActionEnumToProto converts a InstancePreprocessReportInstanceHealthRecipeStepsActionEnum enum to its proto representation. func Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsActionEnumToProto(e *alpha.InstancePreprocessReportInstanceHealthRecipeStepsActionEnum) alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsActionEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsActionEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsActionEnum_value["InstancePreprocessReportInstanceHealthRecipeStepsActionEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsActionEnum(v) } return alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsActionEnum(0) } // InstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnumToProto converts a InstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum enum to its proto representation. func Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnumToProto(e *alpha.InstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum) alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum_value["InstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum(v) } return alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum(0) } // InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnumToProto converts a InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum enum to its proto representation. func Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(e *alpha.InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum) alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum_value["InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum(v) } return alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } // InstanceReportInstanceHealthRecipeStepsActionEnumToProto converts a InstanceReportInstanceHealthRecipeStepsActionEnum enum to its proto representation. func Tier2AlphaInstanceReportInstanceHealthRecipeStepsActionEnumToProto(e *alpha.InstanceReportInstanceHealthRecipeStepsActionEnum) alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsActionEnum { if e == nil { return alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsActionEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsActionEnum_value["InstanceReportInstanceHealthRecipeStepsActionEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsActionEnum(v) } return alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsActionEnum(0) } // InstanceReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnumToProto converts a InstanceReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum enum to its proto representation. func Tier2AlphaInstanceReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnumToProto(e *alpha.InstanceReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum) alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum { if e == nil { return alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum_value["InstanceReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum(v) } return alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnum(0) } // InstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnumToProto converts a InstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum enum to its proto representation. func Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(e *alpha.InstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum) alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == nil { return alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum_value["InstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum(v) } return alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } // InstancePreprocessGetRecipeStepsActionEnumToProto converts a InstancePreprocessGetRecipeStepsActionEnum enum to its proto representation. func Tier2AlphaInstancePreprocessGetRecipeStepsActionEnumToProto(e *alpha.InstancePreprocessGetRecipeStepsActionEnum) alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsActionEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsActionEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsActionEnum_value["InstancePreprocessGetRecipeStepsActionEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsActionEnum(v) } return alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsActionEnum(0) } // InstancePreprocessGetRecipeStepsRequestedTenantProjectScopeEnumToProto converts a InstancePreprocessGetRecipeStepsRequestedTenantProjectScopeEnum enum to its proto representation. func Tier2AlphaInstancePreprocessGetRecipeStepsRequestedTenantProjectScopeEnumToProto(e *alpha.InstancePreprocessGetRecipeStepsRequestedTenantProjectScopeEnum) alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsRequestedTenantProjectScopeEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsRequestedTenantProjectScopeEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsRequestedTenantProjectScopeEnum_value["InstancePreprocessGetRecipeStepsRequestedTenantProjectScopeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsRequestedTenantProjectScopeEnum(v) } return alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsRequestedTenantProjectScopeEnum(0) } // InstancePreprocessGetRecipeStepsPermissionsInfoPolicyNameModeEnumToProto converts a InstancePreprocessGetRecipeStepsPermissionsInfoPolicyNameModeEnum enum to its proto representation. func Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(e *alpha.InstancePreprocessGetRecipeStepsPermissionsInfoPolicyNameModeEnum) alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoPolicyNameModeEnum_value["InstancePreprocessGetRecipeStepsPermissionsInfoPolicyNameModeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoPolicyNameModeEnum(v) } return alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } // InstanceNotifyKeyAvailableRecipeStepsActionEnumToProto converts a InstanceNotifyKeyAvailableRecipeStepsActionEnum enum to its proto representation. func Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsActionEnumToProto(e *alpha.InstanceNotifyKeyAvailableRecipeStepsActionEnum) alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsActionEnum { if e == nil { return alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsActionEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsActionEnum_value["InstanceNotifyKeyAvailableRecipeStepsActionEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsActionEnum(v) } return alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsActionEnum(0) } // InstanceNotifyKeyAvailableRecipeStepsRequestedTenantProjectScopeEnumToProto converts a InstanceNotifyKeyAvailableRecipeStepsRequestedTenantProjectScopeEnum enum to its proto representation. func Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsRequestedTenantProjectScopeEnumToProto(e *alpha.InstanceNotifyKeyAvailableRecipeStepsRequestedTenantProjectScopeEnum) alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsRequestedTenantProjectScopeEnum { if e == nil { return alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsRequestedTenantProjectScopeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsRequestedTenantProjectScopeEnum_value["InstanceNotifyKeyAvailableRecipeStepsRequestedTenantProjectScopeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsRequestedTenantProjectScopeEnum(v) } return alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsRequestedTenantProjectScopeEnum(0) } // InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyNameModeEnumToProto converts a InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyNameModeEnum enum to its proto representation. func Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(e *alpha.InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyNameModeEnum) alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == nil { return alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyNameModeEnum_value["InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyNameModeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyNameModeEnum(v) } return alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } // InstanceNotifyKeyUnavailableRecipeStepsActionEnumToProto converts a InstanceNotifyKeyUnavailableRecipeStepsActionEnum enum to its proto representation. func Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsActionEnumToProto(e *alpha.InstanceNotifyKeyUnavailableRecipeStepsActionEnum) alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsActionEnum { if e == nil { return alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsActionEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsActionEnum_value["InstanceNotifyKeyUnavailableRecipeStepsActionEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsActionEnum(v) } return alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsActionEnum(0) } // InstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProjectScopeEnumToProto converts a InstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProjectScopeEnum enum to its proto representation. func Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProjectScopeEnumToProto(e *alpha.InstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProjectScopeEnum) alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProjectScopeEnum { if e == nil { return alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProjectScopeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProjectScopeEnum_value["InstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProjectScopeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProjectScopeEnum(v) } return alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProjectScopeEnum(0) } // InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyNameModeEnumToProto converts a InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyNameModeEnum enum to its proto representation. func Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(e *alpha.InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyNameModeEnum) alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == nil { return alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyNameModeEnum_value["InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyNameModeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyNameModeEnum(v) } return alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } // InstanceReadonlyRecipeStepsActionEnumToProto converts a InstanceReadonlyRecipeStepsActionEnum enum to its proto representation. func Tier2AlphaInstanceReadonlyRecipeStepsActionEnumToProto(e *alpha.InstanceReadonlyRecipeStepsActionEnum) alphapb.Tier2AlphaInstanceReadonlyRecipeStepsActionEnum { if e == nil { return alphapb.Tier2AlphaInstanceReadonlyRecipeStepsActionEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceReadonlyRecipeStepsActionEnum_value["InstanceReadonlyRecipeStepsActionEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceReadonlyRecipeStepsActionEnum(v) } return alphapb.Tier2AlphaInstanceReadonlyRecipeStepsActionEnum(0) } // InstanceReadonlyRecipeStepsRequestedTenantProjectScopeEnumToProto converts a InstanceReadonlyRecipeStepsRequestedTenantProjectScopeEnum enum to its proto representation. func Tier2AlphaInstanceReadonlyRecipeStepsRequestedTenantProjectScopeEnumToProto(e *alpha.InstanceReadonlyRecipeStepsRequestedTenantProjectScopeEnum) alphapb.Tier2AlphaInstanceReadonlyRecipeStepsRequestedTenantProjectScopeEnum { if e == nil { return alphapb.Tier2AlphaInstanceReadonlyRecipeStepsRequestedTenantProjectScopeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceReadonlyRecipeStepsRequestedTenantProjectScopeEnum_value["InstanceReadonlyRecipeStepsRequestedTenantProjectScopeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceReadonlyRecipeStepsRequestedTenantProjectScopeEnum(v) } return alphapb.Tier2AlphaInstanceReadonlyRecipeStepsRequestedTenantProjectScopeEnum(0) } // InstanceReadonlyRecipeStepsPermissionsInfoPolicyNameModeEnumToProto converts a InstanceReadonlyRecipeStepsPermissionsInfoPolicyNameModeEnum enum to its proto representation. func Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(e *alpha.InstanceReadonlyRecipeStepsPermissionsInfoPolicyNameModeEnum) alphapb.Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == nil { return alphapb.Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoPolicyNameModeEnum_value["InstanceReadonlyRecipeStepsPermissionsInfoPolicyNameModeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoPolicyNameModeEnum(v) } return alphapb.Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } // InstanceReconcileRecipeStepsActionEnumToProto converts a InstanceReconcileRecipeStepsActionEnum enum to its proto representation. func Tier2AlphaInstanceReconcileRecipeStepsActionEnumToProto(e *alpha.InstanceReconcileRecipeStepsActionEnum) alphapb.Tier2AlphaInstanceReconcileRecipeStepsActionEnum { if e == nil { return alphapb.Tier2AlphaInstanceReconcileRecipeStepsActionEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceReconcileRecipeStepsActionEnum_value["InstanceReconcileRecipeStepsActionEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceReconcileRecipeStepsActionEnum(v) } return alphapb.Tier2AlphaInstanceReconcileRecipeStepsActionEnum(0) } // InstanceReconcileRecipeStepsRequestedTenantProjectScopeEnumToProto converts a InstanceReconcileRecipeStepsRequestedTenantProjectScopeEnum enum to its proto representation. func Tier2AlphaInstanceReconcileRecipeStepsRequestedTenantProjectScopeEnumToProto(e *alpha.InstanceReconcileRecipeStepsRequestedTenantProjectScopeEnum) alphapb.Tier2AlphaInstanceReconcileRecipeStepsRequestedTenantProjectScopeEnum { if e == nil { return alphapb.Tier2AlphaInstanceReconcileRecipeStepsRequestedTenantProjectScopeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceReconcileRecipeStepsRequestedTenantProjectScopeEnum_value["InstanceReconcileRecipeStepsRequestedTenantProjectScopeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceReconcileRecipeStepsRequestedTenantProjectScopeEnum(v) } return alphapb.Tier2AlphaInstanceReconcileRecipeStepsRequestedTenantProjectScopeEnum(0) } // InstanceReconcileRecipeStepsPermissionsInfoPolicyNameModeEnumToProto converts a InstanceReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum enum to its proto representation. func Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(e *alpha.InstanceReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum) alphapb.Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == nil { return alphapb.Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } if v, ok := alphapb.Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum_value["InstanceReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum(v) } return alphapb.Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } // InstancePreprocessPassthroughRecipeStepsActionEnumToProto converts a InstancePreprocessPassthroughRecipeStepsActionEnum enum to its proto representation. func Tier2AlphaInstancePreprocessPassthroughRecipeStepsActionEnumToProto(e *alpha.InstancePreprocessPassthroughRecipeStepsActionEnum) alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsActionEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsActionEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsActionEnum_value["InstancePreprocessPassthroughRecipeStepsActionEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsActionEnum(v) } return alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsActionEnum(0) } // InstancePreprocessPassthroughRecipeStepsRequestedTenantProjectScopeEnumToProto converts a InstancePreprocessPassthroughRecipeStepsRequestedTenantProjectScopeEnum enum to its proto representation. func Tier2AlphaInstancePreprocessPassthroughRecipeStepsRequestedTenantProjectScopeEnumToProto(e *alpha.InstancePreprocessPassthroughRecipeStepsRequestedTenantProjectScopeEnum) alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsRequestedTenantProjectScopeEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsRequestedTenantProjectScopeEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsRequestedTenantProjectScopeEnum_value["InstancePreprocessPassthroughRecipeStepsRequestedTenantProjectScopeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsRequestedTenantProjectScopeEnum(v) } return alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsRequestedTenantProjectScopeEnum(0) } // InstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyNameModeEnumToProto converts a InstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyNameModeEnum enum to its proto representation. func Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(e *alpha.InstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyNameModeEnum) alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyNameModeEnum_value["InstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyNameModeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyNameModeEnum(v) } return alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } // InstancePreprocessReconcileRecipeStepsActionEnumToProto converts a InstancePreprocessReconcileRecipeStepsActionEnum enum to its proto representation. func Tier2AlphaInstancePreprocessReconcileRecipeStepsActionEnumToProto(e *alpha.InstancePreprocessReconcileRecipeStepsActionEnum) alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsActionEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsActionEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsActionEnum_value["InstancePreprocessReconcileRecipeStepsActionEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsActionEnum(v) } return alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsActionEnum(0) } // InstancePreprocessReconcileRecipeStepsRequestedTenantProjectScopeEnumToProto converts a InstancePreprocessReconcileRecipeStepsRequestedTenantProjectScopeEnum enum to its proto representation. func Tier2AlphaInstancePreprocessReconcileRecipeStepsRequestedTenantProjectScopeEnumToProto(e *alpha.InstancePreprocessReconcileRecipeStepsRequestedTenantProjectScopeEnum) alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsRequestedTenantProjectScopeEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsRequestedTenantProjectScopeEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsRequestedTenantProjectScopeEnum_value["InstancePreprocessReconcileRecipeStepsRequestedTenantProjectScopeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsRequestedTenantProjectScopeEnum(v) } return alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsRequestedTenantProjectScopeEnum(0) } // InstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyNameModeEnumToProto converts a InstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum enum to its proto representation. func Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(e *alpha.InstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum) alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum { if e == nil { return alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } if v, ok := alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum_value["InstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum"+string(*e)]; ok { return alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum(v) } return alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyNameModeEnum(0) } // InstanceSkuToProto converts a InstanceSku resource to its proto representation. func Tier2AlphaInstanceSkuToProto(o *alpha.InstanceSku) *alphapb.Tier2AlphaInstanceSku { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceSku{ Tier: Tier2AlphaInstanceSkuTierEnumToProto(o.Tier), Size: Tier2AlphaInstanceSkuSizeEnumToProto(o.Size), } return p } // InstanceReferencesToProto converts a InstanceReferences resource to its proto representation. func Tier2AlphaInstanceReferencesToProto(o *alpha.InstanceReferences) *alphapb.Tier2AlphaInstanceReferences { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReferences{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), SourceResource: dcl.ValueOrEmptyString(o.SourceResource), CreateTime: dcl.ValueOrEmptyString(o.CreateTime), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstanceReferencesDetailsToProto(&r)) } return p } // InstanceReferencesDetailsToProto converts a InstanceReferencesDetails resource to its proto representation. func Tier2AlphaInstanceReferencesDetailsToProto(o *alpha.InstanceReferencesDetails) *alphapb.Tier2AlphaInstanceReferencesDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReferencesDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstanceEncryptionKeysToProto converts a InstanceEncryptionKeys resource to its proto representation. func Tier2AlphaInstanceEncryptionKeysToProto(o *alpha.InstanceEncryptionKeys) *alphapb.Tier2AlphaInstanceEncryptionKeys { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceEncryptionKeys{ KeyOrVersion: dcl.ValueOrEmptyString(o.KeyOrVersion), Grant: dcl.ValueOrEmptyString(o.Grant), Delegate: dcl.ValueOrEmptyString(o.Delegate), KeyState: Tier2AlphaInstanceEncryptionKeysKeyStateToProto(o.KeyState), } return p } // InstanceEncryptionKeysKeyStateToProto converts a InstanceEncryptionKeysKeyState resource to its proto representation. func Tier2AlphaInstanceEncryptionKeysKeyStateToProto(o *alpha.InstanceEncryptionKeysKeyState) *alphapb.Tier2AlphaInstanceEncryptionKeysKeyState { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceEncryptionKeysKeyState{ KeyStateVersion: dcl.ValueOrEmptyInt64(o.KeyStateVersion), Availability: Tier2AlphaInstanceEncryptionKeysKeyStateAvailabilityToProto(o.Availability), } return p } // InstanceEncryptionKeysKeyStateAvailabilityToProto converts a InstanceEncryptionKeysKeyStateAvailability resource to its proto representation. func Tier2AlphaInstanceEncryptionKeysKeyStateAvailabilityToProto(o *alpha.InstanceEncryptionKeysKeyStateAvailability) *alphapb.Tier2AlphaInstanceEncryptionKeysKeyStateAvailability { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceEncryptionKeysKeyStateAvailability{ PermissionDenied: dcl.ValueOrEmptyBool(o.PermissionDenied), UnknownFailure: dcl.ValueOrEmptyBool(o.UnknownFailure), KeyVersionState: Tier2AlphaInstanceEncryptionKeysKeyStateAvailabilityKeyVersionStateEnumToProto(o.KeyVersionState), } return p } // InstancePreprocessCreateRecipeToProto converts a InstancePreprocessCreateRecipe resource to its proto representation. func Tier2AlphaInstancePreprocessCreateRecipeToProto(o *alpha.InstancePreprocessCreateRecipe) *alphapb.Tier2AlphaInstancePreprocessCreateRecipe { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessCreateRecipe{ HonorCancelRequest: dcl.ValueOrEmptyBool(o.HonorCancelRequest), IgnoreRecipeAfter: dcl.ValueOrEmptyInt64(o.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.ValueOrEmptyDouble(o.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.ValueOrEmptyBool(o.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.ValueOrEmptyString(o.ReadonlyRecipeStartTime), DelayToStoreResourcesInClhDbNanos: dcl.ValueOrEmptyInt64(o.DelayToStoreResourcesInClhDbNanos), } for _, r := range o.Steps { p.Steps = append(p.Steps, Tier2AlphaInstancePreprocessCreateRecipeStepsToProto(&r)) } for _, r := range o.ResourceNamesStoredInClhWithDelay { p.ResourceNamesStoredInClhWithDelay = append(p.ResourceNamesStoredInClhWithDelay, r) } return p } // InstancePreprocessCreateRecipeStepsToProto converts a InstancePreprocessCreateRecipeSteps resource to its proto representation. func Tier2AlphaInstancePreprocessCreateRecipeStepsToProto(o *alpha.InstancePreprocessCreateRecipeSteps) *alphapb.Tier2AlphaInstancePreprocessCreateRecipeSteps { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessCreateRecipeSteps{ RelativeTime: dcl.ValueOrEmptyInt64(o.RelativeTime), SleepDuration: dcl.ValueOrEmptyInt64(o.SleepDuration), Action: Tier2AlphaInstancePreprocessCreateRecipeStepsActionEnumToProto(o.Action), Status: Tier2AlphaInstancePreprocessCreateRecipeStepsStatusToProto(o.Status), ErrorSpace: dcl.ValueOrEmptyString(o.ErrorSpace), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), ResourceMetadataSize: dcl.ValueOrEmptyInt64(o.ResourceMetadataSize), Description: dcl.ValueOrEmptyString(o.Description), UpdatedRepeatOperationDelaySec: dcl.ValueOrEmptyDouble(o.UpdatedRepeatOperationDelaySec), PreprocessUpdate: Tier2AlphaInstancePreprocessCreateRecipeStepsPreprocessUpdateToProto(o.PreprocessUpdate), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), RequestedTenantProject: Tier2AlphaInstancePreprocessCreateRecipeStepsRequestedTenantProjectToProto(o.RequestedTenantProject), KeyNotificationsUpdate: Tier2AlphaInstancePreprocessCreateRecipeStepsKeyNotificationsUpdateToProto(o.KeyNotificationsUpdate), ClhDataUpdateTime: dcl.ValueOrEmptyString(o.ClhDataUpdateTime), PublicErrorMessage: dcl.ValueOrEmptyString(o.PublicErrorMessage), } for _, r := range o.QuotaRequestDeltas { p.QuotaRequestDeltas = append(p.QuotaRequestDeltas, Tier2AlphaInstancePreprocessCreateRecipeStepsQuotaRequestDeltasToProto(&r)) } for _, r := range o.PermissionsInfo { p.PermissionsInfo = append(p.PermissionsInfo, Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoToProto(&r)) } return p } // InstancePreprocessCreateRecipeStepsStatusToProto converts a InstancePreprocessCreateRecipeStepsStatus resource to its proto representation. func Tier2AlphaInstancePreprocessCreateRecipeStepsStatusToProto(o *alpha.InstancePreprocessCreateRecipeStepsStatus) *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsStatus { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsStatus{ Code: dcl.ValueOrEmptyInt64(o.Code), Message: dcl.ValueOrEmptyString(o.Message), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstancePreprocessCreateRecipeStepsStatusDetailsToProto(&r)) } return p } // InstancePreprocessCreateRecipeStepsStatusDetailsToProto converts a InstancePreprocessCreateRecipeStepsStatusDetails resource to its proto representation. func Tier2AlphaInstancePreprocessCreateRecipeStepsStatusDetailsToProto(o *alpha.InstancePreprocessCreateRecipeStepsStatusDetails) *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsStatusDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsStatusDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstancePreprocessCreateRecipeStepsQuotaRequestDeltasToProto converts a InstancePreprocessCreateRecipeStepsQuotaRequestDeltas resource to its proto representation. func Tier2AlphaInstancePreprocessCreateRecipeStepsQuotaRequestDeltasToProto(o *alpha.InstancePreprocessCreateRecipeStepsQuotaRequestDeltas) *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsQuotaRequestDeltas { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsQuotaRequestDeltas{ MetricName: dcl.ValueOrEmptyString(o.MetricName), Amount: dcl.ValueOrEmptyInt64(o.Amount), QuotaLocationName: dcl.ValueOrEmptyString(o.QuotaLocationName), } return p } // InstancePreprocessCreateRecipeStepsPreprocessUpdateToProto converts a InstancePreprocessCreateRecipeStepsPreprocessUpdate resource to its proto representation. func Tier2AlphaInstancePreprocessCreateRecipeStepsPreprocessUpdateToProto(o *alpha.InstancePreprocessCreateRecipeStepsPreprocessUpdate) *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsPreprocessUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.ValueOrEmptyString(o.LatencySloBucketName), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), } return p } // InstancePreprocessCreateRecipeStepsRequestedTenantProjectToProto converts a InstancePreprocessCreateRecipeStepsRequestedTenantProject resource to its proto representation. func Tier2AlphaInstancePreprocessCreateRecipeStepsRequestedTenantProjectToProto(o *alpha.InstancePreprocessCreateRecipeStepsRequestedTenantProject) *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsRequestedTenantProject { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsRequestedTenantProject{ Tag: dcl.ValueOrEmptyString(o.Tag), Folder: dcl.ValueOrEmptyString(o.Folder), Scope: Tier2AlphaInstancePreprocessCreateRecipeStepsRequestedTenantProjectScopeEnumToProto(o.Scope), } return p } // InstancePreprocessCreateRecipeStepsPermissionsInfoToProto converts a InstancePreprocessCreateRecipeStepsPermissionsInfo resource to its proto representation. func Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoToProto(o *alpha.InstancePreprocessCreateRecipeStepsPermissionsInfo) *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfo{ PolicyName: Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoPolicyNameToProto(o.PolicyName), ResourcePath: dcl.ValueOrEmptyString(o.ResourcePath), ApiAttrs: Tier2AlphaInstanceGoogleprotobufstructToProto(o.ApiAttrs), PolicyNameMode: Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(o.PolicyNameMode), Resource: Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoResourceToProto(o.Resource), } for _, r := range o.IamPermissions { p.IamPermissions = append(p.IamPermissions, Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoIamPermissionsToProto(&r)) } return p } // InstancePreprocessCreateRecipeStepsPermissionsInfoPolicyNameToProto converts a InstancePreprocessCreateRecipeStepsPermissionsInfoPolicyName resource to its proto representation. func Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoPolicyNameToProto(o *alpha.InstancePreprocessCreateRecipeStepsPermissionsInfoPolicyName) *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoPolicyName { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoPolicyName{ Type: dcl.ValueOrEmptyString(o.Type), Id: dcl.ValueOrEmptyString(o.Id), Region: dcl.ValueOrEmptyString(o.Region), } return p } // InstancePreprocessCreateRecipeStepsPermissionsInfoIamPermissionsToProto converts a InstancePreprocessCreateRecipeStepsPermissionsInfoIamPermissions resource to its proto representation. func Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoIamPermissionsToProto(o *alpha.InstancePreprocessCreateRecipeStepsPermissionsInfoIamPermissions) *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoIamPermissions { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.ValueOrEmptyString(o.Permission), } return p } // InstanceGoogleprotobufstructToProto converts a InstanceGoogleprotobufstruct resource to its proto representation. func Tier2AlphaInstanceGoogleprotobufstructToProto(o *alpha.InstanceGoogleprotobufstruct) *alphapb.Tier2AlphaInstanceGoogleprotobufstruct { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceGoogleprotobufstruct{} return p } // InstancePreprocessCreateRecipeStepsPermissionsInfoResourceToProto converts a InstancePreprocessCreateRecipeStepsPermissionsInfoResource resource to its proto representation. func Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoResourceToProto(o *alpha.InstancePreprocessCreateRecipeStepsPermissionsInfoResource) *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoResource { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsPermissionsInfoResource{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), Service: dcl.ValueOrEmptyString(o.Service), } p.Labels = make(map[string]string) for k, r := range o.Labels { p.Labels[k] = r } return p } // InstancePreprocessCreateRecipeStepsKeyNotificationsUpdateToProto converts a InstancePreprocessCreateRecipeStepsKeyNotificationsUpdate resource to its proto representation. func Tier2AlphaInstancePreprocessCreateRecipeStepsKeyNotificationsUpdateToProto(o *alpha.InstancePreprocessCreateRecipeStepsKeyNotificationsUpdate) *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsKeyNotificationsUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: Tier2AlphaInstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o.KeyNotificationsInfo), } return p } // InstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto converts a InstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource to its proto representation. func Tier2AlphaInstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o *alpha.InstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.ValueOrEmptyInt64(o.DataVersion), Delegate: dcl.ValueOrEmptyString(o.Delegate), } for _, r := range o.KeyNotificationConfigs { p.KeyNotificationConfigs = append(p.KeyNotificationConfigs, Tier2AlphaInstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(&r)) } return p } // InstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto converts a InstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource to its proto representation. func Tier2AlphaInstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(o *alpha.InstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.ValueOrEmptyString(o.KeyOrVersionName), Grant: dcl.ValueOrEmptyString(o.Grant), DelegatorGaiaId: dcl.ValueOrEmptyInt64(o.DelegatorGaiaId), } return p } // InstanceCreateRecipeToProto converts a InstanceCreateRecipe resource to its proto representation. func Tier2AlphaInstanceCreateRecipeToProto(o *alpha.InstanceCreateRecipe) *alphapb.Tier2AlphaInstanceCreateRecipe { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceCreateRecipe{ HonorCancelRequest: dcl.ValueOrEmptyBool(o.HonorCancelRequest), IgnoreRecipeAfter: dcl.ValueOrEmptyInt64(o.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.ValueOrEmptyDouble(o.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.ValueOrEmptyBool(o.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.ValueOrEmptyString(o.ReadonlyRecipeStartTime), DelayToStoreResourcesInClhDbNanos: dcl.ValueOrEmptyInt64(o.DelayToStoreResourcesInClhDbNanos), } for _, r := range o.Steps { p.Steps = append(p.Steps, Tier2AlphaInstanceCreateRecipeStepsToProto(&r)) } for _, r := range o.ResourceNamesStoredInClhWithDelay { p.ResourceNamesStoredInClhWithDelay = append(p.ResourceNamesStoredInClhWithDelay, r) } return p } // InstanceCreateRecipeStepsToProto converts a InstanceCreateRecipeSteps resource to its proto representation. func Tier2AlphaInstanceCreateRecipeStepsToProto(o *alpha.InstanceCreateRecipeSteps) *alphapb.Tier2AlphaInstanceCreateRecipeSteps { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceCreateRecipeSteps{ RelativeTime: dcl.ValueOrEmptyInt64(o.RelativeTime), SleepDuration: dcl.ValueOrEmptyInt64(o.SleepDuration), Action: Tier2AlphaInstanceCreateRecipeStepsActionEnumToProto(o.Action), Status: Tier2AlphaInstanceCreateRecipeStepsStatusToProto(o.Status), ErrorSpace: dcl.ValueOrEmptyString(o.ErrorSpace), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), ResourceMetadataSize: dcl.ValueOrEmptyInt64(o.ResourceMetadataSize), Description: dcl.ValueOrEmptyString(o.Description), UpdatedRepeatOperationDelaySec: dcl.ValueOrEmptyDouble(o.UpdatedRepeatOperationDelaySec), PreprocessUpdate: Tier2AlphaInstanceCreateRecipeStepsPreprocessUpdateToProto(o.PreprocessUpdate), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), RequestedTenantProject: Tier2AlphaInstanceCreateRecipeStepsRequestedTenantProjectToProto(o.RequestedTenantProject), KeyNotificationsUpdate: Tier2AlphaInstanceCreateRecipeStepsKeyNotificationsUpdateToProto(o.KeyNotificationsUpdate), ClhDataUpdateTime: dcl.ValueOrEmptyString(o.ClhDataUpdateTime), PublicErrorMessage: dcl.ValueOrEmptyString(o.PublicErrorMessage), } for _, r := range o.QuotaRequestDeltas { p.QuotaRequestDeltas = append(p.QuotaRequestDeltas, Tier2AlphaInstanceCreateRecipeStepsQuotaRequestDeltasToProto(&r)) } for _, r := range o.PermissionsInfo { p.PermissionsInfo = append(p.PermissionsInfo, Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoToProto(&r)) } return p } // InstanceCreateRecipeStepsStatusToProto converts a InstanceCreateRecipeStepsStatus resource to its proto representation. func Tier2AlphaInstanceCreateRecipeStepsStatusToProto(o *alpha.InstanceCreateRecipeStepsStatus) *alphapb.Tier2AlphaInstanceCreateRecipeStepsStatus { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceCreateRecipeStepsStatus{ Code: dcl.ValueOrEmptyInt64(o.Code), Message: dcl.ValueOrEmptyString(o.Message), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstanceCreateRecipeStepsStatusDetailsToProto(&r)) } return p } // InstanceCreateRecipeStepsStatusDetailsToProto converts a InstanceCreateRecipeStepsStatusDetails resource to its proto representation. func Tier2AlphaInstanceCreateRecipeStepsStatusDetailsToProto(o *alpha.InstanceCreateRecipeStepsStatusDetails) *alphapb.Tier2AlphaInstanceCreateRecipeStepsStatusDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceCreateRecipeStepsStatusDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstanceCreateRecipeStepsQuotaRequestDeltasToProto converts a InstanceCreateRecipeStepsQuotaRequestDeltas resource to its proto representation. func Tier2AlphaInstanceCreateRecipeStepsQuotaRequestDeltasToProto(o *alpha.InstanceCreateRecipeStepsQuotaRequestDeltas) *alphapb.Tier2AlphaInstanceCreateRecipeStepsQuotaRequestDeltas { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceCreateRecipeStepsQuotaRequestDeltas{ MetricName: dcl.ValueOrEmptyString(o.MetricName), Amount: dcl.ValueOrEmptyInt64(o.Amount), QuotaLocationName: dcl.ValueOrEmptyString(o.QuotaLocationName), } return p } // InstanceCreateRecipeStepsPreprocessUpdateToProto converts a InstanceCreateRecipeStepsPreprocessUpdate resource to its proto representation. func Tier2AlphaInstanceCreateRecipeStepsPreprocessUpdateToProto(o *alpha.InstanceCreateRecipeStepsPreprocessUpdate) *alphapb.Tier2AlphaInstanceCreateRecipeStepsPreprocessUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceCreateRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.ValueOrEmptyString(o.LatencySloBucketName), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), } return p } // InstanceCreateRecipeStepsRequestedTenantProjectToProto converts a InstanceCreateRecipeStepsRequestedTenantProject resource to its proto representation. func Tier2AlphaInstanceCreateRecipeStepsRequestedTenantProjectToProto(o *alpha.InstanceCreateRecipeStepsRequestedTenantProject) *alphapb.Tier2AlphaInstanceCreateRecipeStepsRequestedTenantProject { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceCreateRecipeStepsRequestedTenantProject{ Tag: dcl.ValueOrEmptyString(o.Tag), Folder: dcl.ValueOrEmptyString(o.Folder), Scope: Tier2AlphaInstanceCreateRecipeStepsRequestedTenantProjectScopeEnumToProto(o.Scope), } return p } // InstanceCreateRecipeStepsPermissionsInfoToProto converts a InstanceCreateRecipeStepsPermissionsInfo resource to its proto representation. func Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoToProto(o *alpha.InstanceCreateRecipeStepsPermissionsInfo) *alphapb.Tier2AlphaInstanceCreateRecipeStepsPermissionsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceCreateRecipeStepsPermissionsInfo{ PolicyName: Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoPolicyNameToProto(o.PolicyName), ResourcePath: dcl.ValueOrEmptyString(o.ResourcePath), ApiAttrs: Tier2AlphaInstanceGoogleprotobufstructToProto(o.ApiAttrs), PolicyNameMode: Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(o.PolicyNameMode), Resource: Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoResourceToProto(o.Resource), } for _, r := range o.IamPermissions { p.IamPermissions = append(p.IamPermissions, Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoIamPermissionsToProto(&r)) } return p } // InstanceCreateRecipeStepsPermissionsInfoPolicyNameToProto converts a InstanceCreateRecipeStepsPermissionsInfoPolicyName resource to its proto representation. func Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoPolicyNameToProto(o *alpha.InstanceCreateRecipeStepsPermissionsInfoPolicyName) *alphapb.Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoPolicyName { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoPolicyName{ Type: dcl.ValueOrEmptyString(o.Type), Id: dcl.ValueOrEmptyString(o.Id), Region: dcl.ValueOrEmptyString(o.Region), } return p } // InstanceCreateRecipeStepsPermissionsInfoIamPermissionsToProto converts a InstanceCreateRecipeStepsPermissionsInfoIamPermissions resource to its proto representation. func Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoIamPermissionsToProto(o *alpha.InstanceCreateRecipeStepsPermissionsInfoIamPermissions) *alphapb.Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoIamPermissions { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.ValueOrEmptyString(o.Permission), } return p } // InstanceCreateRecipeStepsPermissionsInfoResourceToProto converts a InstanceCreateRecipeStepsPermissionsInfoResource resource to its proto representation. func Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoResourceToProto(o *alpha.InstanceCreateRecipeStepsPermissionsInfoResource) *alphapb.Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoResource { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceCreateRecipeStepsPermissionsInfoResource{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), Service: dcl.ValueOrEmptyString(o.Service), } p.Labels = make(map[string]string) for k, r := range o.Labels { p.Labels[k] = r } return p } // InstanceCreateRecipeStepsKeyNotificationsUpdateToProto converts a InstanceCreateRecipeStepsKeyNotificationsUpdate resource to its proto representation. func Tier2AlphaInstanceCreateRecipeStepsKeyNotificationsUpdateToProto(o *alpha.InstanceCreateRecipeStepsKeyNotificationsUpdate) *alphapb.Tier2AlphaInstanceCreateRecipeStepsKeyNotificationsUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceCreateRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: Tier2AlphaInstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o.KeyNotificationsInfo), } return p } // InstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto converts a InstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource to its proto representation. func Tier2AlphaInstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o *alpha.InstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alphapb.Tier2AlphaInstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.ValueOrEmptyInt64(o.DataVersion), Delegate: dcl.ValueOrEmptyString(o.Delegate), } for _, r := range o.KeyNotificationConfigs { p.KeyNotificationConfigs = append(p.KeyNotificationConfigs, Tier2AlphaInstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(&r)) } return p } // InstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto converts a InstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource to its proto representation. func Tier2AlphaInstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(o *alpha.InstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alphapb.Tier2AlphaInstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceCreateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.ValueOrEmptyString(o.KeyOrVersionName), Grant: dcl.ValueOrEmptyString(o.Grant), DelegatorGaiaId: dcl.ValueOrEmptyInt64(o.DelegatorGaiaId), } return p } // InstanceDeleteRecipeToProto converts a InstanceDeleteRecipe resource to its proto representation. func Tier2AlphaInstanceDeleteRecipeToProto(o *alpha.InstanceDeleteRecipe) *alphapb.Tier2AlphaInstanceDeleteRecipe { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceDeleteRecipe{ HonorCancelRequest: dcl.ValueOrEmptyBool(o.HonorCancelRequest), IgnoreRecipeAfter: dcl.ValueOrEmptyInt64(o.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.ValueOrEmptyDouble(o.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.ValueOrEmptyBool(o.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.ValueOrEmptyString(o.ReadonlyRecipeStartTime), DelayToStoreResourcesInClhDbNanos: dcl.ValueOrEmptyInt64(o.DelayToStoreResourcesInClhDbNanos), } for _, r := range o.Steps { p.Steps = append(p.Steps, Tier2AlphaInstanceDeleteRecipeStepsToProto(&r)) } for _, r := range o.ResourceNamesStoredInClhWithDelay { p.ResourceNamesStoredInClhWithDelay = append(p.ResourceNamesStoredInClhWithDelay, r) } return p } // InstanceDeleteRecipeStepsToProto converts a InstanceDeleteRecipeSteps resource to its proto representation. func Tier2AlphaInstanceDeleteRecipeStepsToProto(o *alpha.InstanceDeleteRecipeSteps) *alphapb.Tier2AlphaInstanceDeleteRecipeSteps { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceDeleteRecipeSteps{ RelativeTime: dcl.ValueOrEmptyInt64(o.RelativeTime), SleepDuration: dcl.ValueOrEmptyInt64(o.SleepDuration), Action: Tier2AlphaInstanceDeleteRecipeStepsActionEnumToProto(o.Action), Status: Tier2AlphaInstanceDeleteRecipeStepsStatusToProto(o.Status), ErrorSpace: dcl.ValueOrEmptyString(o.ErrorSpace), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), ResourceMetadataSize: dcl.ValueOrEmptyInt64(o.ResourceMetadataSize), Description: dcl.ValueOrEmptyString(o.Description), UpdatedRepeatOperationDelaySec: dcl.ValueOrEmptyDouble(o.UpdatedRepeatOperationDelaySec), PreprocessUpdate: Tier2AlphaInstanceDeleteRecipeStepsPreprocessUpdateToProto(o.PreprocessUpdate), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), RequestedTenantProject: Tier2AlphaInstanceDeleteRecipeStepsRequestedTenantProjectToProto(o.RequestedTenantProject), KeyNotificationsUpdate: Tier2AlphaInstanceDeleteRecipeStepsKeyNotificationsUpdateToProto(o.KeyNotificationsUpdate), ClhDataUpdateTime: dcl.ValueOrEmptyString(o.ClhDataUpdateTime), PublicErrorMessage: dcl.ValueOrEmptyString(o.PublicErrorMessage), } for _, r := range o.QuotaRequestDeltas { p.QuotaRequestDeltas = append(p.QuotaRequestDeltas, Tier2AlphaInstanceDeleteRecipeStepsQuotaRequestDeltasToProto(&r)) } for _, r := range o.PermissionsInfo { p.PermissionsInfo = append(p.PermissionsInfo, Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoToProto(&r)) } return p } // InstanceDeleteRecipeStepsStatusToProto converts a InstanceDeleteRecipeStepsStatus resource to its proto representation. func Tier2AlphaInstanceDeleteRecipeStepsStatusToProto(o *alpha.InstanceDeleteRecipeStepsStatus) *alphapb.Tier2AlphaInstanceDeleteRecipeStepsStatus { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceDeleteRecipeStepsStatus{ Code: dcl.ValueOrEmptyInt64(o.Code), Message: dcl.ValueOrEmptyString(o.Message), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstanceDeleteRecipeStepsStatusDetailsToProto(&r)) } return p } // InstanceDeleteRecipeStepsStatusDetailsToProto converts a InstanceDeleteRecipeStepsStatusDetails resource to its proto representation. func Tier2AlphaInstanceDeleteRecipeStepsStatusDetailsToProto(o *alpha.InstanceDeleteRecipeStepsStatusDetails) *alphapb.Tier2AlphaInstanceDeleteRecipeStepsStatusDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceDeleteRecipeStepsStatusDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstanceDeleteRecipeStepsQuotaRequestDeltasToProto converts a InstanceDeleteRecipeStepsQuotaRequestDeltas resource to its proto representation. func Tier2AlphaInstanceDeleteRecipeStepsQuotaRequestDeltasToProto(o *alpha.InstanceDeleteRecipeStepsQuotaRequestDeltas) *alphapb.Tier2AlphaInstanceDeleteRecipeStepsQuotaRequestDeltas { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceDeleteRecipeStepsQuotaRequestDeltas{ MetricName: dcl.ValueOrEmptyString(o.MetricName), Amount: dcl.ValueOrEmptyInt64(o.Amount), QuotaLocationName: dcl.ValueOrEmptyString(o.QuotaLocationName), } return p } // InstanceDeleteRecipeStepsPreprocessUpdateToProto converts a InstanceDeleteRecipeStepsPreprocessUpdate resource to its proto representation. func Tier2AlphaInstanceDeleteRecipeStepsPreprocessUpdateToProto(o *alpha.InstanceDeleteRecipeStepsPreprocessUpdate) *alphapb.Tier2AlphaInstanceDeleteRecipeStepsPreprocessUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceDeleteRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.ValueOrEmptyString(o.LatencySloBucketName), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), } return p } // InstanceDeleteRecipeStepsRequestedTenantProjectToProto converts a InstanceDeleteRecipeStepsRequestedTenantProject resource to its proto representation. func Tier2AlphaInstanceDeleteRecipeStepsRequestedTenantProjectToProto(o *alpha.InstanceDeleteRecipeStepsRequestedTenantProject) *alphapb.Tier2AlphaInstanceDeleteRecipeStepsRequestedTenantProject { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceDeleteRecipeStepsRequestedTenantProject{ Tag: dcl.ValueOrEmptyString(o.Tag), Folder: dcl.ValueOrEmptyString(o.Folder), Scope: Tier2AlphaInstanceDeleteRecipeStepsRequestedTenantProjectScopeEnumToProto(o.Scope), } return p } // InstanceDeleteRecipeStepsPermissionsInfoToProto converts a InstanceDeleteRecipeStepsPermissionsInfo resource to its proto representation. func Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoToProto(o *alpha.InstanceDeleteRecipeStepsPermissionsInfo) *alphapb.Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfo{ PolicyName: Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoPolicyNameToProto(o.PolicyName), ResourcePath: dcl.ValueOrEmptyString(o.ResourcePath), ApiAttrs: Tier2AlphaInstanceGoogleprotobufstructToProto(o.ApiAttrs), PolicyNameMode: Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(o.PolicyNameMode), Resource: Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoResourceToProto(o.Resource), } for _, r := range o.IamPermissions { p.IamPermissions = append(p.IamPermissions, Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoIamPermissionsToProto(&r)) } return p } // InstanceDeleteRecipeStepsPermissionsInfoPolicyNameToProto converts a InstanceDeleteRecipeStepsPermissionsInfoPolicyName resource to its proto representation. func Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoPolicyNameToProto(o *alpha.InstanceDeleteRecipeStepsPermissionsInfoPolicyName) *alphapb.Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoPolicyName { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoPolicyName{ Type: dcl.ValueOrEmptyString(o.Type), Id: dcl.ValueOrEmptyString(o.Id), Region: dcl.ValueOrEmptyString(o.Region), } return p } // InstanceDeleteRecipeStepsPermissionsInfoIamPermissionsToProto converts a InstanceDeleteRecipeStepsPermissionsInfoIamPermissions resource to its proto representation. func Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoIamPermissionsToProto(o *alpha.InstanceDeleteRecipeStepsPermissionsInfoIamPermissions) *alphapb.Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoIamPermissions { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.ValueOrEmptyString(o.Permission), } return p } // InstanceDeleteRecipeStepsPermissionsInfoResourceToProto converts a InstanceDeleteRecipeStepsPermissionsInfoResource resource to its proto representation. func Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoResourceToProto(o *alpha.InstanceDeleteRecipeStepsPermissionsInfoResource) *alphapb.Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoResource { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceDeleteRecipeStepsPermissionsInfoResource{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), Service: dcl.ValueOrEmptyString(o.Service), } p.Labels = make(map[string]string) for k, r := range o.Labels { p.Labels[k] = r } return p } // InstanceDeleteRecipeStepsKeyNotificationsUpdateToProto converts a InstanceDeleteRecipeStepsKeyNotificationsUpdate resource to its proto representation. func Tier2AlphaInstanceDeleteRecipeStepsKeyNotificationsUpdateToProto(o *alpha.InstanceDeleteRecipeStepsKeyNotificationsUpdate) *alphapb.Tier2AlphaInstanceDeleteRecipeStepsKeyNotificationsUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceDeleteRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: Tier2AlphaInstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o.KeyNotificationsInfo), } return p } // InstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto converts a InstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource to its proto representation. func Tier2AlphaInstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o *alpha.InstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alphapb.Tier2AlphaInstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.ValueOrEmptyInt64(o.DataVersion), Delegate: dcl.ValueOrEmptyString(o.Delegate), } for _, r := range o.KeyNotificationConfigs { p.KeyNotificationConfigs = append(p.KeyNotificationConfigs, Tier2AlphaInstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(&r)) } return p } // InstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto converts a InstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource to its proto representation. func Tier2AlphaInstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(o *alpha.InstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alphapb.Tier2AlphaInstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.ValueOrEmptyString(o.KeyOrVersionName), Grant: dcl.ValueOrEmptyString(o.Grant), DelegatorGaiaId: dcl.ValueOrEmptyInt64(o.DelegatorGaiaId), } return p } // InstanceUpdateRecipeToProto converts a InstanceUpdateRecipe resource to its proto representation. func Tier2AlphaInstanceUpdateRecipeToProto(o *alpha.InstanceUpdateRecipe) *alphapb.Tier2AlphaInstanceUpdateRecipe { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUpdateRecipe{ HonorCancelRequest: dcl.ValueOrEmptyBool(o.HonorCancelRequest), IgnoreRecipeAfter: dcl.ValueOrEmptyInt64(o.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.ValueOrEmptyDouble(o.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.ValueOrEmptyBool(o.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.ValueOrEmptyString(o.ReadonlyRecipeStartTime), DelayToStoreResourcesInClhDbNanos: dcl.ValueOrEmptyInt64(o.DelayToStoreResourcesInClhDbNanos), } for _, r := range o.Steps { p.Steps = append(p.Steps, Tier2AlphaInstanceUpdateRecipeStepsToProto(&r)) } for _, r := range o.ResourceNamesStoredInClhWithDelay { p.ResourceNamesStoredInClhWithDelay = append(p.ResourceNamesStoredInClhWithDelay, r) } return p } // InstanceUpdateRecipeStepsToProto converts a InstanceUpdateRecipeSteps resource to its proto representation. func Tier2AlphaInstanceUpdateRecipeStepsToProto(o *alpha.InstanceUpdateRecipeSteps) *alphapb.Tier2AlphaInstanceUpdateRecipeSteps { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUpdateRecipeSteps{ RelativeTime: dcl.ValueOrEmptyInt64(o.RelativeTime), SleepDuration: dcl.ValueOrEmptyInt64(o.SleepDuration), Action: Tier2AlphaInstanceUpdateRecipeStepsActionEnumToProto(o.Action), Status: Tier2AlphaInstanceUpdateRecipeStepsStatusToProto(o.Status), ErrorSpace: dcl.ValueOrEmptyString(o.ErrorSpace), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), ResourceMetadataSize: dcl.ValueOrEmptyInt64(o.ResourceMetadataSize), Description: dcl.ValueOrEmptyString(o.Description), UpdatedRepeatOperationDelaySec: dcl.ValueOrEmptyDouble(o.UpdatedRepeatOperationDelaySec), PreprocessUpdate: Tier2AlphaInstanceUpdateRecipeStepsPreprocessUpdateToProto(o.PreprocessUpdate), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), RequestedTenantProject: Tier2AlphaInstanceUpdateRecipeStepsRequestedTenantProjectToProto(o.RequestedTenantProject), KeyNotificationsUpdate: Tier2AlphaInstanceUpdateRecipeStepsKeyNotificationsUpdateToProto(o.KeyNotificationsUpdate), ClhDataUpdateTime: dcl.ValueOrEmptyString(o.ClhDataUpdateTime), PublicErrorMessage: dcl.ValueOrEmptyString(o.PublicErrorMessage), } for _, r := range o.QuotaRequestDeltas { p.QuotaRequestDeltas = append(p.QuotaRequestDeltas, Tier2AlphaInstanceUpdateRecipeStepsQuotaRequestDeltasToProto(&r)) } for _, r := range o.PermissionsInfo { p.PermissionsInfo = append(p.PermissionsInfo, Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoToProto(&r)) } return p } // InstanceUpdateRecipeStepsStatusToProto converts a InstanceUpdateRecipeStepsStatus resource to its proto representation. func Tier2AlphaInstanceUpdateRecipeStepsStatusToProto(o *alpha.InstanceUpdateRecipeStepsStatus) *alphapb.Tier2AlphaInstanceUpdateRecipeStepsStatus { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUpdateRecipeStepsStatus{ Code: dcl.ValueOrEmptyInt64(o.Code), Message: dcl.ValueOrEmptyString(o.Message), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstanceUpdateRecipeStepsStatusDetailsToProto(&r)) } return p } // InstanceUpdateRecipeStepsStatusDetailsToProto converts a InstanceUpdateRecipeStepsStatusDetails resource to its proto representation. func Tier2AlphaInstanceUpdateRecipeStepsStatusDetailsToProto(o *alpha.InstanceUpdateRecipeStepsStatusDetails) *alphapb.Tier2AlphaInstanceUpdateRecipeStepsStatusDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUpdateRecipeStepsStatusDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstanceUpdateRecipeStepsQuotaRequestDeltasToProto converts a InstanceUpdateRecipeStepsQuotaRequestDeltas resource to its proto representation. func Tier2AlphaInstanceUpdateRecipeStepsQuotaRequestDeltasToProto(o *alpha.InstanceUpdateRecipeStepsQuotaRequestDeltas) *alphapb.Tier2AlphaInstanceUpdateRecipeStepsQuotaRequestDeltas { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUpdateRecipeStepsQuotaRequestDeltas{ MetricName: dcl.ValueOrEmptyString(o.MetricName), Amount: dcl.ValueOrEmptyInt64(o.Amount), QuotaLocationName: dcl.ValueOrEmptyString(o.QuotaLocationName), } return p } // InstanceUpdateRecipeStepsPreprocessUpdateToProto converts a InstanceUpdateRecipeStepsPreprocessUpdate resource to its proto representation. func Tier2AlphaInstanceUpdateRecipeStepsPreprocessUpdateToProto(o *alpha.InstanceUpdateRecipeStepsPreprocessUpdate) *alphapb.Tier2AlphaInstanceUpdateRecipeStepsPreprocessUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUpdateRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.ValueOrEmptyString(o.LatencySloBucketName), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), } return p } // InstanceUpdateRecipeStepsRequestedTenantProjectToProto converts a InstanceUpdateRecipeStepsRequestedTenantProject resource to its proto representation. func Tier2AlphaInstanceUpdateRecipeStepsRequestedTenantProjectToProto(o *alpha.InstanceUpdateRecipeStepsRequestedTenantProject) *alphapb.Tier2AlphaInstanceUpdateRecipeStepsRequestedTenantProject { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUpdateRecipeStepsRequestedTenantProject{ Tag: dcl.ValueOrEmptyString(o.Tag), Folder: dcl.ValueOrEmptyString(o.Folder), Scope: Tier2AlphaInstanceUpdateRecipeStepsRequestedTenantProjectScopeEnumToProto(o.Scope), } return p } // InstanceUpdateRecipeStepsPermissionsInfoToProto converts a InstanceUpdateRecipeStepsPermissionsInfo resource to its proto representation. func Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoToProto(o *alpha.InstanceUpdateRecipeStepsPermissionsInfo) *alphapb.Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfo{ PolicyName: Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoPolicyNameToProto(o.PolicyName), ResourcePath: dcl.ValueOrEmptyString(o.ResourcePath), ApiAttrs: Tier2AlphaInstanceGoogleprotobufstructToProto(o.ApiAttrs), PolicyNameMode: Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(o.PolicyNameMode), Resource: Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoResourceToProto(o.Resource), } for _, r := range o.IamPermissions { p.IamPermissions = append(p.IamPermissions, Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoIamPermissionsToProto(&r)) } return p } // InstanceUpdateRecipeStepsPermissionsInfoPolicyNameToProto converts a InstanceUpdateRecipeStepsPermissionsInfoPolicyName resource to its proto representation. func Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoPolicyNameToProto(o *alpha.InstanceUpdateRecipeStepsPermissionsInfoPolicyName) *alphapb.Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoPolicyName { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoPolicyName{ Type: dcl.ValueOrEmptyString(o.Type), Id: dcl.ValueOrEmptyString(o.Id), Region: dcl.ValueOrEmptyString(o.Region), } return p } // InstanceUpdateRecipeStepsPermissionsInfoIamPermissionsToProto converts a InstanceUpdateRecipeStepsPermissionsInfoIamPermissions resource to its proto representation. func Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoIamPermissionsToProto(o *alpha.InstanceUpdateRecipeStepsPermissionsInfoIamPermissions) *alphapb.Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoIamPermissions { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.ValueOrEmptyString(o.Permission), } return p } // InstanceUpdateRecipeStepsPermissionsInfoResourceToProto converts a InstanceUpdateRecipeStepsPermissionsInfoResource resource to its proto representation. func Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoResourceToProto(o *alpha.InstanceUpdateRecipeStepsPermissionsInfoResource) *alphapb.Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoResource { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUpdateRecipeStepsPermissionsInfoResource{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), Service: dcl.ValueOrEmptyString(o.Service), } p.Labels = make(map[string]string) for k, r := range o.Labels { p.Labels[k] = r } return p } // InstanceUpdateRecipeStepsKeyNotificationsUpdateToProto converts a InstanceUpdateRecipeStepsKeyNotificationsUpdate resource to its proto representation. func Tier2AlphaInstanceUpdateRecipeStepsKeyNotificationsUpdateToProto(o *alpha.InstanceUpdateRecipeStepsKeyNotificationsUpdate) *alphapb.Tier2AlphaInstanceUpdateRecipeStepsKeyNotificationsUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUpdateRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: Tier2AlphaInstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o.KeyNotificationsInfo), } return p } // InstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto converts a InstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource to its proto representation. func Tier2AlphaInstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o *alpha.InstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alphapb.Tier2AlphaInstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.ValueOrEmptyInt64(o.DataVersion), Delegate: dcl.ValueOrEmptyString(o.Delegate), } for _, r := range o.KeyNotificationConfigs { p.KeyNotificationConfigs = append(p.KeyNotificationConfigs, Tier2AlphaInstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(&r)) } return p } // InstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto converts a InstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource to its proto representation. func Tier2AlphaInstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(o *alpha.InstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alphapb.Tier2AlphaInstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.ValueOrEmptyString(o.KeyOrVersionName), Grant: dcl.ValueOrEmptyString(o.Grant), DelegatorGaiaId: dcl.ValueOrEmptyInt64(o.DelegatorGaiaId), } return p } // InstancePreprocessResetRecipeToProto converts a InstancePreprocessResetRecipe resource to its proto representation. func Tier2AlphaInstancePreprocessResetRecipeToProto(o *alpha.InstancePreprocessResetRecipe) *alphapb.Tier2AlphaInstancePreprocessResetRecipe { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessResetRecipe{ HonorCancelRequest: dcl.ValueOrEmptyBool(o.HonorCancelRequest), IgnoreRecipeAfter: dcl.ValueOrEmptyInt64(o.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.ValueOrEmptyDouble(o.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.ValueOrEmptyBool(o.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.ValueOrEmptyString(o.ReadonlyRecipeStartTime), DelayToStoreResourcesInClhDbNanos: dcl.ValueOrEmptyInt64(o.DelayToStoreResourcesInClhDbNanos), } for _, r := range o.Steps { p.Steps = append(p.Steps, Tier2AlphaInstancePreprocessResetRecipeStepsToProto(&r)) } for _, r := range o.ResourceNamesStoredInClhWithDelay { p.ResourceNamesStoredInClhWithDelay = append(p.ResourceNamesStoredInClhWithDelay, r) } return p } // InstancePreprocessResetRecipeStepsToProto converts a InstancePreprocessResetRecipeSteps resource to its proto representation. func Tier2AlphaInstancePreprocessResetRecipeStepsToProto(o *alpha.InstancePreprocessResetRecipeSteps) *alphapb.Tier2AlphaInstancePreprocessResetRecipeSteps { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessResetRecipeSteps{ RelativeTime: dcl.ValueOrEmptyInt64(o.RelativeTime), SleepDuration: dcl.ValueOrEmptyInt64(o.SleepDuration), Action: Tier2AlphaInstancePreprocessResetRecipeStepsActionEnumToProto(o.Action), Status: Tier2AlphaInstancePreprocessResetRecipeStepsStatusToProto(o.Status), ErrorSpace: dcl.ValueOrEmptyString(o.ErrorSpace), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), ResourceMetadataSize: dcl.ValueOrEmptyInt64(o.ResourceMetadataSize), Description: dcl.ValueOrEmptyString(o.Description), UpdatedRepeatOperationDelaySec: dcl.ValueOrEmptyDouble(o.UpdatedRepeatOperationDelaySec), PreprocessUpdate: Tier2AlphaInstancePreprocessResetRecipeStepsPreprocessUpdateToProto(o.PreprocessUpdate), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), RequestedTenantProject: Tier2AlphaInstancePreprocessResetRecipeStepsRequestedTenantProjectToProto(o.RequestedTenantProject), KeyNotificationsUpdate: Tier2AlphaInstancePreprocessResetRecipeStepsKeyNotificationsUpdateToProto(o.KeyNotificationsUpdate), ClhDataUpdateTime: dcl.ValueOrEmptyString(o.ClhDataUpdateTime), PublicErrorMessage: dcl.ValueOrEmptyString(o.PublicErrorMessage), } for _, r := range o.QuotaRequestDeltas { p.QuotaRequestDeltas = append(p.QuotaRequestDeltas, Tier2AlphaInstancePreprocessResetRecipeStepsQuotaRequestDeltasToProto(&r)) } for _, r := range o.PermissionsInfo { p.PermissionsInfo = append(p.PermissionsInfo, Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoToProto(&r)) } return p } // InstancePreprocessResetRecipeStepsStatusToProto converts a InstancePreprocessResetRecipeStepsStatus resource to its proto representation. func Tier2AlphaInstancePreprocessResetRecipeStepsStatusToProto(o *alpha.InstancePreprocessResetRecipeStepsStatus) *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsStatus { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsStatus{ Code: dcl.ValueOrEmptyInt64(o.Code), Message: dcl.ValueOrEmptyString(o.Message), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstancePreprocessResetRecipeStepsStatusDetailsToProto(&r)) } return p } // InstancePreprocessResetRecipeStepsStatusDetailsToProto converts a InstancePreprocessResetRecipeStepsStatusDetails resource to its proto representation. func Tier2AlphaInstancePreprocessResetRecipeStepsStatusDetailsToProto(o *alpha.InstancePreprocessResetRecipeStepsStatusDetails) *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsStatusDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsStatusDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstancePreprocessResetRecipeStepsQuotaRequestDeltasToProto converts a InstancePreprocessResetRecipeStepsQuotaRequestDeltas resource to its proto representation. func Tier2AlphaInstancePreprocessResetRecipeStepsQuotaRequestDeltasToProto(o *alpha.InstancePreprocessResetRecipeStepsQuotaRequestDeltas) *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsQuotaRequestDeltas { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsQuotaRequestDeltas{ MetricName: dcl.ValueOrEmptyString(o.MetricName), Amount: dcl.ValueOrEmptyInt64(o.Amount), QuotaLocationName: dcl.ValueOrEmptyString(o.QuotaLocationName), } return p } // InstancePreprocessResetRecipeStepsPreprocessUpdateToProto converts a InstancePreprocessResetRecipeStepsPreprocessUpdate resource to its proto representation. func Tier2AlphaInstancePreprocessResetRecipeStepsPreprocessUpdateToProto(o *alpha.InstancePreprocessResetRecipeStepsPreprocessUpdate) *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsPreprocessUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.ValueOrEmptyString(o.LatencySloBucketName), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), } return p } // InstancePreprocessResetRecipeStepsRequestedTenantProjectToProto converts a InstancePreprocessResetRecipeStepsRequestedTenantProject resource to its proto representation. func Tier2AlphaInstancePreprocessResetRecipeStepsRequestedTenantProjectToProto(o *alpha.InstancePreprocessResetRecipeStepsRequestedTenantProject) *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsRequestedTenantProject { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsRequestedTenantProject{ Tag: dcl.ValueOrEmptyString(o.Tag), Folder: dcl.ValueOrEmptyString(o.Folder), Scope: Tier2AlphaInstancePreprocessResetRecipeStepsRequestedTenantProjectScopeEnumToProto(o.Scope), } return p } // InstancePreprocessResetRecipeStepsPermissionsInfoToProto converts a InstancePreprocessResetRecipeStepsPermissionsInfo resource to its proto representation. func Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoToProto(o *alpha.InstancePreprocessResetRecipeStepsPermissionsInfo) *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfo{ PolicyName: Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoPolicyNameToProto(o.PolicyName), ResourcePath: dcl.ValueOrEmptyString(o.ResourcePath), ApiAttrs: Tier2AlphaInstanceGoogleprotobufstructToProto(o.ApiAttrs), PolicyNameMode: Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(o.PolicyNameMode), Resource: Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoResourceToProto(o.Resource), } for _, r := range o.IamPermissions { p.IamPermissions = append(p.IamPermissions, Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoIamPermissionsToProto(&r)) } return p } // InstancePreprocessResetRecipeStepsPermissionsInfoPolicyNameToProto converts a InstancePreprocessResetRecipeStepsPermissionsInfoPolicyName resource to its proto representation. func Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoPolicyNameToProto(o *alpha.InstancePreprocessResetRecipeStepsPermissionsInfoPolicyName) *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoPolicyName { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoPolicyName{ Type: dcl.ValueOrEmptyString(o.Type), Id: dcl.ValueOrEmptyString(o.Id), Region: dcl.ValueOrEmptyString(o.Region), } return p } // InstancePreprocessResetRecipeStepsPermissionsInfoIamPermissionsToProto converts a InstancePreprocessResetRecipeStepsPermissionsInfoIamPermissions resource to its proto representation. func Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoIamPermissionsToProto(o *alpha.InstancePreprocessResetRecipeStepsPermissionsInfoIamPermissions) *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoIamPermissions { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.ValueOrEmptyString(o.Permission), } return p } // InstancePreprocessResetRecipeStepsPermissionsInfoResourceToProto converts a InstancePreprocessResetRecipeStepsPermissionsInfoResource resource to its proto representation. func Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoResourceToProto(o *alpha.InstancePreprocessResetRecipeStepsPermissionsInfoResource) *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoResource { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsPermissionsInfoResource{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), Service: dcl.ValueOrEmptyString(o.Service), } p.Labels = make(map[string]string) for k, r := range o.Labels { p.Labels[k] = r } return p } // InstancePreprocessResetRecipeStepsKeyNotificationsUpdateToProto converts a InstancePreprocessResetRecipeStepsKeyNotificationsUpdate resource to its proto representation. func Tier2AlphaInstancePreprocessResetRecipeStepsKeyNotificationsUpdateToProto(o *alpha.InstancePreprocessResetRecipeStepsKeyNotificationsUpdate) *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsKeyNotificationsUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: Tier2AlphaInstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o.KeyNotificationsInfo), } return p } // InstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto converts a InstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource to its proto representation. func Tier2AlphaInstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o *alpha.InstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.ValueOrEmptyInt64(o.DataVersion), Delegate: dcl.ValueOrEmptyString(o.Delegate), } for _, r := range o.KeyNotificationConfigs { p.KeyNotificationConfigs = append(p.KeyNotificationConfigs, Tier2AlphaInstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(&r)) } return p } // InstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto converts a InstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource to its proto representation. func Tier2AlphaInstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(o *alpha.InstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.ValueOrEmptyString(o.KeyOrVersionName), Grant: dcl.ValueOrEmptyString(o.Grant), DelegatorGaiaId: dcl.ValueOrEmptyInt64(o.DelegatorGaiaId), } return p } // InstanceResetRecipeToProto converts a InstanceResetRecipe resource to its proto representation. func Tier2AlphaInstanceResetRecipeToProto(o *alpha.InstanceResetRecipe) *alphapb.Tier2AlphaInstanceResetRecipe { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceResetRecipe{ HonorCancelRequest: dcl.ValueOrEmptyBool(o.HonorCancelRequest), IgnoreRecipeAfter: dcl.ValueOrEmptyInt64(o.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.ValueOrEmptyDouble(o.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.ValueOrEmptyBool(o.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.ValueOrEmptyString(o.ReadonlyRecipeStartTime), DelayToStoreResourcesInClhDbNanos: dcl.ValueOrEmptyInt64(o.DelayToStoreResourcesInClhDbNanos), } for _, r := range o.Steps { p.Steps = append(p.Steps, Tier2AlphaInstanceResetRecipeStepsToProto(&r)) } for _, r := range o.ResourceNamesStoredInClhWithDelay { p.ResourceNamesStoredInClhWithDelay = append(p.ResourceNamesStoredInClhWithDelay, r) } return p } // InstanceResetRecipeStepsToProto converts a InstanceResetRecipeSteps resource to its proto representation. func Tier2AlphaInstanceResetRecipeStepsToProto(o *alpha.InstanceResetRecipeSteps) *alphapb.Tier2AlphaInstanceResetRecipeSteps { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceResetRecipeSteps{ RelativeTime: dcl.ValueOrEmptyInt64(o.RelativeTime), SleepDuration: dcl.ValueOrEmptyInt64(o.SleepDuration), Action: Tier2AlphaInstanceResetRecipeStepsActionEnumToProto(o.Action), Status: Tier2AlphaInstanceResetRecipeStepsStatusToProto(o.Status), ErrorSpace: dcl.ValueOrEmptyString(o.ErrorSpace), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), ResourceMetadataSize: dcl.ValueOrEmptyInt64(o.ResourceMetadataSize), Description: dcl.ValueOrEmptyString(o.Description), UpdatedRepeatOperationDelaySec: dcl.ValueOrEmptyDouble(o.UpdatedRepeatOperationDelaySec), PreprocessUpdate: Tier2AlphaInstanceResetRecipeStepsPreprocessUpdateToProto(o.PreprocessUpdate), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), RequestedTenantProject: Tier2AlphaInstanceResetRecipeStepsRequestedTenantProjectToProto(o.RequestedTenantProject), KeyNotificationsUpdate: Tier2AlphaInstanceResetRecipeStepsKeyNotificationsUpdateToProto(o.KeyNotificationsUpdate), ClhDataUpdateTime: dcl.ValueOrEmptyString(o.ClhDataUpdateTime), PublicErrorMessage: dcl.ValueOrEmptyString(o.PublicErrorMessage), } for _, r := range o.QuotaRequestDeltas { p.QuotaRequestDeltas = append(p.QuotaRequestDeltas, Tier2AlphaInstanceResetRecipeStepsQuotaRequestDeltasToProto(&r)) } for _, r := range o.PermissionsInfo { p.PermissionsInfo = append(p.PermissionsInfo, Tier2AlphaInstanceResetRecipeStepsPermissionsInfoToProto(&r)) } return p } // InstanceResetRecipeStepsStatusToProto converts a InstanceResetRecipeStepsStatus resource to its proto representation. func Tier2AlphaInstanceResetRecipeStepsStatusToProto(o *alpha.InstanceResetRecipeStepsStatus) *alphapb.Tier2AlphaInstanceResetRecipeStepsStatus { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceResetRecipeStepsStatus{ Code: dcl.ValueOrEmptyInt64(o.Code), Message: dcl.ValueOrEmptyString(o.Message), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstanceResetRecipeStepsStatusDetailsToProto(&r)) } return p } // InstanceResetRecipeStepsStatusDetailsToProto converts a InstanceResetRecipeStepsStatusDetails resource to its proto representation. func Tier2AlphaInstanceResetRecipeStepsStatusDetailsToProto(o *alpha.InstanceResetRecipeStepsStatusDetails) *alphapb.Tier2AlphaInstanceResetRecipeStepsStatusDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceResetRecipeStepsStatusDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstanceResetRecipeStepsQuotaRequestDeltasToProto converts a InstanceResetRecipeStepsQuotaRequestDeltas resource to its proto representation. func Tier2AlphaInstanceResetRecipeStepsQuotaRequestDeltasToProto(o *alpha.InstanceResetRecipeStepsQuotaRequestDeltas) *alphapb.Tier2AlphaInstanceResetRecipeStepsQuotaRequestDeltas { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceResetRecipeStepsQuotaRequestDeltas{ MetricName: dcl.ValueOrEmptyString(o.MetricName), Amount: dcl.ValueOrEmptyInt64(o.Amount), QuotaLocationName: dcl.ValueOrEmptyString(o.QuotaLocationName), } return p } // InstanceResetRecipeStepsPreprocessUpdateToProto converts a InstanceResetRecipeStepsPreprocessUpdate resource to its proto representation. func Tier2AlphaInstanceResetRecipeStepsPreprocessUpdateToProto(o *alpha.InstanceResetRecipeStepsPreprocessUpdate) *alphapb.Tier2AlphaInstanceResetRecipeStepsPreprocessUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceResetRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.ValueOrEmptyString(o.LatencySloBucketName), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), } return p } // InstanceResetRecipeStepsRequestedTenantProjectToProto converts a InstanceResetRecipeStepsRequestedTenantProject resource to its proto representation. func Tier2AlphaInstanceResetRecipeStepsRequestedTenantProjectToProto(o *alpha.InstanceResetRecipeStepsRequestedTenantProject) *alphapb.Tier2AlphaInstanceResetRecipeStepsRequestedTenantProject { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceResetRecipeStepsRequestedTenantProject{ Tag: dcl.ValueOrEmptyString(o.Tag), Folder: dcl.ValueOrEmptyString(o.Folder), Scope: Tier2AlphaInstanceResetRecipeStepsRequestedTenantProjectScopeEnumToProto(o.Scope), } return p } // InstanceResetRecipeStepsPermissionsInfoToProto converts a InstanceResetRecipeStepsPermissionsInfo resource to its proto representation. func Tier2AlphaInstanceResetRecipeStepsPermissionsInfoToProto(o *alpha.InstanceResetRecipeStepsPermissionsInfo) *alphapb.Tier2AlphaInstanceResetRecipeStepsPermissionsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceResetRecipeStepsPermissionsInfo{ PolicyName: Tier2AlphaInstanceResetRecipeStepsPermissionsInfoPolicyNameToProto(o.PolicyName), ResourcePath: dcl.ValueOrEmptyString(o.ResourcePath), ApiAttrs: Tier2AlphaInstanceGoogleprotobufstructToProto(o.ApiAttrs), PolicyNameMode: Tier2AlphaInstanceResetRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(o.PolicyNameMode), Resource: Tier2AlphaInstanceResetRecipeStepsPermissionsInfoResourceToProto(o.Resource), } for _, r := range o.IamPermissions { p.IamPermissions = append(p.IamPermissions, Tier2AlphaInstanceResetRecipeStepsPermissionsInfoIamPermissionsToProto(&r)) } return p } // InstanceResetRecipeStepsPermissionsInfoPolicyNameToProto converts a InstanceResetRecipeStepsPermissionsInfoPolicyName resource to its proto representation. func Tier2AlphaInstanceResetRecipeStepsPermissionsInfoPolicyNameToProto(o *alpha.InstanceResetRecipeStepsPermissionsInfoPolicyName) *alphapb.Tier2AlphaInstanceResetRecipeStepsPermissionsInfoPolicyName { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceResetRecipeStepsPermissionsInfoPolicyName{ Type: dcl.ValueOrEmptyString(o.Type), Id: dcl.ValueOrEmptyString(o.Id), Region: dcl.ValueOrEmptyString(o.Region), } return p } // InstanceResetRecipeStepsPermissionsInfoIamPermissionsToProto converts a InstanceResetRecipeStepsPermissionsInfoIamPermissions resource to its proto representation. func Tier2AlphaInstanceResetRecipeStepsPermissionsInfoIamPermissionsToProto(o *alpha.InstanceResetRecipeStepsPermissionsInfoIamPermissions) *alphapb.Tier2AlphaInstanceResetRecipeStepsPermissionsInfoIamPermissions { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceResetRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.ValueOrEmptyString(o.Permission), } return p } // InstanceResetRecipeStepsPermissionsInfoResourceToProto converts a InstanceResetRecipeStepsPermissionsInfoResource resource to its proto representation. func Tier2AlphaInstanceResetRecipeStepsPermissionsInfoResourceToProto(o *alpha.InstanceResetRecipeStepsPermissionsInfoResource) *alphapb.Tier2AlphaInstanceResetRecipeStepsPermissionsInfoResource { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceResetRecipeStepsPermissionsInfoResource{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), Service: dcl.ValueOrEmptyString(o.Service), } p.Labels = make(map[string]string) for k, r := range o.Labels { p.Labels[k] = r } return p } // InstanceResetRecipeStepsKeyNotificationsUpdateToProto converts a InstanceResetRecipeStepsKeyNotificationsUpdate resource to its proto representation. func Tier2AlphaInstanceResetRecipeStepsKeyNotificationsUpdateToProto(o *alpha.InstanceResetRecipeStepsKeyNotificationsUpdate) *alphapb.Tier2AlphaInstanceResetRecipeStepsKeyNotificationsUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceResetRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: Tier2AlphaInstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o.KeyNotificationsInfo), } return p } // InstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto converts a InstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource to its proto representation. func Tier2AlphaInstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o *alpha.InstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alphapb.Tier2AlphaInstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.ValueOrEmptyInt64(o.DataVersion), Delegate: dcl.ValueOrEmptyString(o.Delegate), } for _, r := range o.KeyNotificationConfigs { p.KeyNotificationConfigs = append(p.KeyNotificationConfigs, Tier2AlphaInstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(&r)) } return p } // InstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto converts a InstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource to its proto representation. func Tier2AlphaInstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(o *alpha.InstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alphapb.Tier2AlphaInstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceResetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.ValueOrEmptyString(o.KeyOrVersionName), Grant: dcl.ValueOrEmptyString(o.Grant), DelegatorGaiaId: dcl.ValueOrEmptyInt64(o.DelegatorGaiaId), } return p } // InstancePreprocessRepairRecipeToProto converts a InstancePreprocessRepairRecipe resource to its proto representation. func Tier2AlphaInstancePreprocessRepairRecipeToProto(o *alpha.InstancePreprocessRepairRecipe) *alphapb.Tier2AlphaInstancePreprocessRepairRecipe { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessRepairRecipe{ HonorCancelRequest: dcl.ValueOrEmptyBool(o.HonorCancelRequest), IgnoreRecipeAfter: dcl.ValueOrEmptyInt64(o.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.ValueOrEmptyDouble(o.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.ValueOrEmptyBool(o.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.ValueOrEmptyString(o.ReadonlyRecipeStartTime), DelayToStoreResourcesInClhDbNanos: dcl.ValueOrEmptyInt64(o.DelayToStoreResourcesInClhDbNanos), } for _, r := range o.Steps { p.Steps = append(p.Steps, Tier2AlphaInstancePreprocessRepairRecipeStepsToProto(&r)) } for _, r := range o.ResourceNamesStoredInClhWithDelay { p.ResourceNamesStoredInClhWithDelay = append(p.ResourceNamesStoredInClhWithDelay, r) } return p } // InstancePreprocessRepairRecipeStepsToProto converts a InstancePreprocessRepairRecipeSteps resource to its proto representation. func Tier2AlphaInstancePreprocessRepairRecipeStepsToProto(o *alpha.InstancePreprocessRepairRecipeSteps) *alphapb.Tier2AlphaInstancePreprocessRepairRecipeSteps { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessRepairRecipeSteps{ RelativeTime: dcl.ValueOrEmptyInt64(o.RelativeTime), SleepDuration: dcl.ValueOrEmptyInt64(o.SleepDuration), Action: Tier2AlphaInstancePreprocessRepairRecipeStepsActionEnumToProto(o.Action), Status: Tier2AlphaInstancePreprocessRepairRecipeStepsStatusToProto(o.Status), ErrorSpace: dcl.ValueOrEmptyString(o.ErrorSpace), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), ResourceMetadataSize: dcl.ValueOrEmptyInt64(o.ResourceMetadataSize), Description: dcl.ValueOrEmptyString(o.Description), UpdatedRepeatOperationDelaySec: dcl.ValueOrEmptyDouble(o.UpdatedRepeatOperationDelaySec), PreprocessUpdate: Tier2AlphaInstancePreprocessRepairRecipeStepsPreprocessUpdateToProto(o.PreprocessUpdate), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), RequestedTenantProject: Tier2AlphaInstancePreprocessRepairRecipeStepsRequestedTenantProjectToProto(o.RequestedTenantProject), KeyNotificationsUpdate: Tier2AlphaInstancePreprocessRepairRecipeStepsKeyNotificationsUpdateToProto(o.KeyNotificationsUpdate), ClhDataUpdateTime: dcl.ValueOrEmptyString(o.ClhDataUpdateTime), PublicErrorMessage: dcl.ValueOrEmptyString(o.PublicErrorMessage), } for _, r := range o.QuotaRequestDeltas { p.QuotaRequestDeltas = append(p.QuotaRequestDeltas, Tier2AlphaInstancePreprocessRepairRecipeStepsQuotaRequestDeltasToProto(&r)) } for _, r := range o.PermissionsInfo { p.PermissionsInfo = append(p.PermissionsInfo, Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoToProto(&r)) } return p } // InstancePreprocessRepairRecipeStepsStatusToProto converts a InstancePreprocessRepairRecipeStepsStatus resource to its proto representation. func Tier2AlphaInstancePreprocessRepairRecipeStepsStatusToProto(o *alpha.InstancePreprocessRepairRecipeStepsStatus) *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsStatus { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsStatus{ Code: dcl.ValueOrEmptyInt64(o.Code), Message: dcl.ValueOrEmptyString(o.Message), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstancePreprocessRepairRecipeStepsStatusDetailsToProto(&r)) } return p } // InstancePreprocessRepairRecipeStepsStatusDetailsToProto converts a InstancePreprocessRepairRecipeStepsStatusDetails resource to its proto representation. func Tier2AlphaInstancePreprocessRepairRecipeStepsStatusDetailsToProto(o *alpha.InstancePreprocessRepairRecipeStepsStatusDetails) *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsStatusDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsStatusDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstancePreprocessRepairRecipeStepsQuotaRequestDeltasToProto converts a InstancePreprocessRepairRecipeStepsQuotaRequestDeltas resource to its proto representation. func Tier2AlphaInstancePreprocessRepairRecipeStepsQuotaRequestDeltasToProto(o *alpha.InstancePreprocessRepairRecipeStepsQuotaRequestDeltas) *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsQuotaRequestDeltas { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsQuotaRequestDeltas{ MetricName: dcl.ValueOrEmptyString(o.MetricName), Amount: dcl.ValueOrEmptyInt64(o.Amount), QuotaLocationName: dcl.ValueOrEmptyString(o.QuotaLocationName), } return p } // InstancePreprocessRepairRecipeStepsPreprocessUpdateToProto converts a InstancePreprocessRepairRecipeStepsPreprocessUpdate resource to its proto representation. func Tier2AlphaInstancePreprocessRepairRecipeStepsPreprocessUpdateToProto(o *alpha.InstancePreprocessRepairRecipeStepsPreprocessUpdate) *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsPreprocessUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.ValueOrEmptyString(o.LatencySloBucketName), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), } return p } // InstancePreprocessRepairRecipeStepsRequestedTenantProjectToProto converts a InstancePreprocessRepairRecipeStepsRequestedTenantProject resource to its proto representation. func Tier2AlphaInstancePreprocessRepairRecipeStepsRequestedTenantProjectToProto(o *alpha.InstancePreprocessRepairRecipeStepsRequestedTenantProject) *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsRequestedTenantProject { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsRequestedTenantProject{ Tag: dcl.ValueOrEmptyString(o.Tag), Folder: dcl.ValueOrEmptyString(o.Folder), Scope: Tier2AlphaInstancePreprocessRepairRecipeStepsRequestedTenantProjectScopeEnumToProto(o.Scope), } return p } // InstancePreprocessRepairRecipeStepsPermissionsInfoToProto converts a InstancePreprocessRepairRecipeStepsPermissionsInfo resource to its proto representation. func Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoToProto(o *alpha.InstancePreprocessRepairRecipeStepsPermissionsInfo) *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfo{ PolicyName: Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoPolicyNameToProto(o.PolicyName), ResourcePath: dcl.ValueOrEmptyString(o.ResourcePath), ApiAttrs: Tier2AlphaInstanceGoogleprotobufstructToProto(o.ApiAttrs), PolicyNameMode: Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(o.PolicyNameMode), Resource: Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoResourceToProto(o.Resource), } for _, r := range o.IamPermissions { p.IamPermissions = append(p.IamPermissions, Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoIamPermissionsToProto(&r)) } return p } // InstancePreprocessRepairRecipeStepsPermissionsInfoPolicyNameToProto converts a InstancePreprocessRepairRecipeStepsPermissionsInfoPolicyName resource to its proto representation. func Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoPolicyNameToProto(o *alpha.InstancePreprocessRepairRecipeStepsPermissionsInfoPolicyName) *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoPolicyName { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoPolicyName{ Type: dcl.ValueOrEmptyString(o.Type), Id: dcl.ValueOrEmptyString(o.Id), Region: dcl.ValueOrEmptyString(o.Region), } return p } // InstancePreprocessRepairRecipeStepsPermissionsInfoIamPermissionsToProto converts a InstancePreprocessRepairRecipeStepsPermissionsInfoIamPermissions resource to its proto representation. func Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoIamPermissionsToProto(o *alpha.InstancePreprocessRepairRecipeStepsPermissionsInfoIamPermissions) *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoIamPermissions { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.ValueOrEmptyString(o.Permission), } return p } // InstancePreprocessRepairRecipeStepsPermissionsInfoResourceToProto converts a InstancePreprocessRepairRecipeStepsPermissionsInfoResource resource to its proto representation. func Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoResourceToProto(o *alpha.InstancePreprocessRepairRecipeStepsPermissionsInfoResource) *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoResource { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsPermissionsInfoResource{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), Service: dcl.ValueOrEmptyString(o.Service), } p.Labels = make(map[string]string) for k, r := range o.Labels { p.Labels[k] = r } return p } // InstancePreprocessRepairRecipeStepsKeyNotificationsUpdateToProto converts a InstancePreprocessRepairRecipeStepsKeyNotificationsUpdate resource to its proto representation. func Tier2AlphaInstancePreprocessRepairRecipeStepsKeyNotificationsUpdateToProto(o *alpha.InstancePreprocessRepairRecipeStepsKeyNotificationsUpdate) *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsKeyNotificationsUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: Tier2AlphaInstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o.KeyNotificationsInfo), } return p } // InstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto converts a InstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource to its proto representation. func Tier2AlphaInstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o *alpha.InstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.ValueOrEmptyInt64(o.DataVersion), Delegate: dcl.ValueOrEmptyString(o.Delegate), } for _, r := range o.KeyNotificationConfigs { p.KeyNotificationConfigs = append(p.KeyNotificationConfigs, Tier2AlphaInstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(&r)) } return p } // InstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto converts a InstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource to its proto representation. func Tier2AlphaInstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(o *alpha.InstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.ValueOrEmptyString(o.KeyOrVersionName), Grant: dcl.ValueOrEmptyString(o.Grant), DelegatorGaiaId: dcl.ValueOrEmptyInt64(o.DelegatorGaiaId), } return p } // InstanceRepairRecipeToProto converts a InstanceRepairRecipe resource to its proto representation. func Tier2AlphaInstanceRepairRecipeToProto(o *alpha.InstanceRepairRecipe) *alphapb.Tier2AlphaInstanceRepairRecipe { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceRepairRecipe{ HonorCancelRequest: dcl.ValueOrEmptyBool(o.HonorCancelRequest), IgnoreRecipeAfter: dcl.ValueOrEmptyInt64(o.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.ValueOrEmptyDouble(o.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.ValueOrEmptyBool(o.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.ValueOrEmptyString(o.ReadonlyRecipeStartTime), DelayToStoreResourcesInClhDbNanos: dcl.ValueOrEmptyInt64(o.DelayToStoreResourcesInClhDbNanos), } for _, r := range o.Steps { p.Steps = append(p.Steps, Tier2AlphaInstanceRepairRecipeStepsToProto(&r)) } for _, r := range o.ResourceNamesStoredInClhWithDelay { p.ResourceNamesStoredInClhWithDelay = append(p.ResourceNamesStoredInClhWithDelay, r) } return p } // InstanceRepairRecipeStepsToProto converts a InstanceRepairRecipeSteps resource to its proto representation. func Tier2AlphaInstanceRepairRecipeStepsToProto(o *alpha.InstanceRepairRecipeSteps) *alphapb.Tier2AlphaInstanceRepairRecipeSteps { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceRepairRecipeSteps{ RelativeTime: dcl.ValueOrEmptyInt64(o.RelativeTime), SleepDuration: dcl.ValueOrEmptyInt64(o.SleepDuration), Action: Tier2AlphaInstanceRepairRecipeStepsActionEnumToProto(o.Action), Status: Tier2AlphaInstanceRepairRecipeStepsStatusToProto(o.Status), ErrorSpace: dcl.ValueOrEmptyString(o.ErrorSpace), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), ResourceMetadataSize: dcl.ValueOrEmptyInt64(o.ResourceMetadataSize), Description: dcl.ValueOrEmptyString(o.Description), UpdatedRepeatOperationDelaySec: dcl.ValueOrEmptyDouble(o.UpdatedRepeatOperationDelaySec), PreprocessUpdate: Tier2AlphaInstanceRepairRecipeStepsPreprocessUpdateToProto(o.PreprocessUpdate), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), RequestedTenantProject: Tier2AlphaInstanceRepairRecipeStepsRequestedTenantProjectToProto(o.RequestedTenantProject), KeyNotificationsUpdate: Tier2AlphaInstanceRepairRecipeStepsKeyNotificationsUpdateToProto(o.KeyNotificationsUpdate), ClhDataUpdateTime: dcl.ValueOrEmptyString(o.ClhDataUpdateTime), PublicErrorMessage: dcl.ValueOrEmptyString(o.PublicErrorMessage), } for _, r := range o.QuotaRequestDeltas { p.QuotaRequestDeltas = append(p.QuotaRequestDeltas, Tier2AlphaInstanceRepairRecipeStepsQuotaRequestDeltasToProto(&r)) } for _, r := range o.PermissionsInfo { p.PermissionsInfo = append(p.PermissionsInfo, Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoToProto(&r)) } return p } // InstanceRepairRecipeStepsStatusToProto converts a InstanceRepairRecipeStepsStatus resource to its proto representation. func Tier2AlphaInstanceRepairRecipeStepsStatusToProto(o *alpha.InstanceRepairRecipeStepsStatus) *alphapb.Tier2AlphaInstanceRepairRecipeStepsStatus { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceRepairRecipeStepsStatus{ Code: dcl.ValueOrEmptyInt64(o.Code), Message: dcl.ValueOrEmptyString(o.Message), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstanceRepairRecipeStepsStatusDetailsToProto(&r)) } return p } // InstanceRepairRecipeStepsStatusDetailsToProto converts a InstanceRepairRecipeStepsStatusDetails resource to its proto representation. func Tier2AlphaInstanceRepairRecipeStepsStatusDetailsToProto(o *alpha.InstanceRepairRecipeStepsStatusDetails) *alphapb.Tier2AlphaInstanceRepairRecipeStepsStatusDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceRepairRecipeStepsStatusDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstanceRepairRecipeStepsQuotaRequestDeltasToProto converts a InstanceRepairRecipeStepsQuotaRequestDeltas resource to its proto representation. func Tier2AlphaInstanceRepairRecipeStepsQuotaRequestDeltasToProto(o *alpha.InstanceRepairRecipeStepsQuotaRequestDeltas) *alphapb.Tier2AlphaInstanceRepairRecipeStepsQuotaRequestDeltas { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceRepairRecipeStepsQuotaRequestDeltas{ MetricName: dcl.ValueOrEmptyString(o.MetricName), Amount: dcl.ValueOrEmptyInt64(o.Amount), QuotaLocationName: dcl.ValueOrEmptyString(o.QuotaLocationName), } return p } // InstanceRepairRecipeStepsPreprocessUpdateToProto converts a InstanceRepairRecipeStepsPreprocessUpdate resource to its proto representation. func Tier2AlphaInstanceRepairRecipeStepsPreprocessUpdateToProto(o *alpha.InstanceRepairRecipeStepsPreprocessUpdate) *alphapb.Tier2AlphaInstanceRepairRecipeStepsPreprocessUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceRepairRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.ValueOrEmptyString(o.LatencySloBucketName), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), } return p } // InstanceRepairRecipeStepsRequestedTenantProjectToProto converts a InstanceRepairRecipeStepsRequestedTenantProject resource to its proto representation. func Tier2AlphaInstanceRepairRecipeStepsRequestedTenantProjectToProto(o *alpha.InstanceRepairRecipeStepsRequestedTenantProject) *alphapb.Tier2AlphaInstanceRepairRecipeStepsRequestedTenantProject { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceRepairRecipeStepsRequestedTenantProject{ Tag: dcl.ValueOrEmptyString(o.Tag), Folder: dcl.ValueOrEmptyString(o.Folder), Scope: Tier2AlphaInstanceRepairRecipeStepsRequestedTenantProjectScopeEnumToProto(o.Scope), } return p } // InstanceRepairRecipeStepsPermissionsInfoToProto converts a InstanceRepairRecipeStepsPermissionsInfo resource to its proto representation. func Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoToProto(o *alpha.InstanceRepairRecipeStepsPermissionsInfo) *alphapb.Tier2AlphaInstanceRepairRecipeStepsPermissionsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceRepairRecipeStepsPermissionsInfo{ PolicyName: Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoPolicyNameToProto(o.PolicyName), ResourcePath: dcl.ValueOrEmptyString(o.ResourcePath), ApiAttrs: Tier2AlphaInstanceGoogleprotobufstructToProto(o.ApiAttrs), PolicyNameMode: Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(o.PolicyNameMode), Resource: Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoResourceToProto(o.Resource), } for _, r := range o.IamPermissions { p.IamPermissions = append(p.IamPermissions, Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoIamPermissionsToProto(&r)) } return p } // InstanceRepairRecipeStepsPermissionsInfoPolicyNameToProto converts a InstanceRepairRecipeStepsPermissionsInfoPolicyName resource to its proto representation. func Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoPolicyNameToProto(o *alpha.InstanceRepairRecipeStepsPermissionsInfoPolicyName) *alphapb.Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoPolicyName { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoPolicyName{ Type: dcl.ValueOrEmptyString(o.Type), Id: dcl.ValueOrEmptyString(o.Id), Region: dcl.ValueOrEmptyString(o.Region), } return p } // InstanceRepairRecipeStepsPermissionsInfoIamPermissionsToProto converts a InstanceRepairRecipeStepsPermissionsInfoIamPermissions resource to its proto representation. func Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoIamPermissionsToProto(o *alpha.InstanceRepairRecipeStepsPermissionsInfoIamPermissions) *alphapb.Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoIamPermissions { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.ValueOrEmptyString(o.Permission), } return p } // InstanceRepairRecipeStepsPermissionsInfoResourceToProto converts a InstanceRepairRecipeStepsPermissionsInfoResource resource to its proto representation. func Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoResourceToProto(o *alpha.InstanceRepairRecipeStepsPermissionsInfoResource) *alphapb.Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoResource { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceRepairRecipeStepsPermissionsInfoResource{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), Service: dcl.ValueOrEmptyString(o.Service), } p.Labels = make(map[string]string) for k, r := range o.Labels { p.Labels[k] = r } return p } // InstanceRepairRecipeStepsKeyNotificationsUpdateToProto converts a InstanceRepairRecipeStepsKeyNotificationsUpdate resource to its proto representation. func Tier2AlphaInstanceRepairRecipeStepsKeyNotificationsUpdateToProto(o *alpha.InstanceRepairRecipeStepsKeyNotificationsUpdate) *alphapb.Tier2AlphaInstanceRepairRecipeStepsKeyNotificationsUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceRepairRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: Tier2AlphaInstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o.KeyNotificationsInfo), } return p } // InstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto converts a InstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource to its proto representation. func Tier2AlphaInstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o *alpha.InstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alphapb.Tier2AlphaInstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.ValueOrEmptyInt64(o.DataVersion), Delegate: dcl.ValueOrEmptyString(o.Delegate), } for _, r := range o.KeyNotificationConfigs { p.KeyNotificationConfigs = append(p.KeyNotificationConfigs, Tier2AlphaInstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(&r)) } return p } // InstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto converts a InstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource to its proto representation. func Tier2AlphaInstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(o *alpha.InstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alphapb.Tier2AlphaInstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceRepairRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.ValueOrEmptyString(o.KeyOrVersionName), Grant: dcl.ValueOrEmptyString(o.Grant), DelegatorGaiaId: dcl.ValueOrEmptyInt64(o.DelegatorGaiaId), } return p } // InstancePreprocessDeleteRecipeToProto converts a InstancePreprocessDeleteRecipe resource to its proto representation. func Tier2AlphaInstancePreprocessDeleteRecipeToProto(o *alpha.InstancePreprocessDeleteRecipe) *alphapb.Tier2AlphaInstancePreprocessDeleteRecipe { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessDeleteRecipe{ HonorCancelRequest: dcl.ValueOrEmptyBool(o.HonorCancelRequest), IgnoreRecipeAfter: dcl.ValueOrEmptyInt64(o.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.ValueOrEmptyDouble(o.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.ValueOrEmptyBool(o.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.ValueOrEmptyString(o.ReadonlyRecipeStartTime), DelayToStoreResourcesInClhDbNanos: dcl.ValueOrEmptyInt64(o.DelayToStoreResourcesInClhDbNanos), } for _, r := range o.Steps { p.Steps = append(p.Steps, Tier2AlphaInstancePreprocessDeleteRecipeStepsToProto(&r)) } for _, r := range o.ResourceNamesStoredInClhWithDelay { p.ResourceNamesStoredInClhWithDelay = append(p.ResourceNamesStoredInClhWithDelay, r) } return p } // InstancePreprocessDeleteRecipeStepsToProto converts a InstancePreprocessDeleteRecipeSteps resource to its proto representation. func Tier2AlphaInstancePreprocessDeleteRecipeStepsToProto(o *alpha.InstancePreprocessDeleteRecipeSteps) *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeSteps { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessDeleteRecipeSteps{ RelativeTime: dcl.ValueOrEmptyInt64(o.RelativeTime), SleepDuration: dcl.ValueOrEmptyInt64(o.SleepDuration), Action: Tier2AlphaInstancePreprocessDeleteRecipeStepsActionEnumToProto(o.Action), Status: Tier2AlphaInstancePreprocessDeleteRecipeStepsStatusToProto(o.Status), ErrorSpace: dcl.ValueOrEmptyString(o.ErrorSpace), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), ResourceMetadataSize: dcl.ValueOrEmptyInt64(o.ResourceMetadataSize), Description: dcl.ValueOrEmptyString(o.Description), UpdatedRepeatOperationDelaySec: dcl.ValueOrEmptyDouble(o.UpdatedRepeatOperationDelaySec), PreprocessUpdate: Tier2AlphaInstancePreprocessDeleteRecipeStepsPreprocessUpdateToProto(o.PreprocessUpdate), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), RequestedTenantProject: Tier2AlphaInstancePreprocessDeleteRecipeStepsRequestedTenantProjectToProto(o.RequestedTenantProject), KeyNotificationsUpdate: Tier2AlphaInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateToProto(o.KeyNotificationsUpdate), ClhDataUpdateTime: dcl.ValueOrEmptyString(o.ClhDataUpdateTime), PublicErrorMessage: dcl.ValueOrEmptyString(o.PublicErrorMessage), } for _, r := range o.QuotaRequestDeltas { p.QuotaRequestDeltas = append(p.QuotaRequestDeltas, Tier2AlphaInstancePreprocessDeleteRecipeStepsQuotaRequestDeltasToProto(&r)) } for _, r := range o.PermissionsInfo { p.PermissionsInfo = append(p.PermissionsInfo, Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoToProto(&r)) } return p } // InstancePreprocessDeleteRecipeStepsStatusToProto converts a InstancePreprocessDeleteRecipeStepsStatus resource to its proto representation. func Tier2AlphaInstancePreprocessDeleteRecipeStepsStatusToProto(o *alpha.InstancePreprocessDeleteRecipeStepsStatus) *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsStatus { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsStatus{ Code: dcl.ValueOrEmptyInt64(o.Code), Message: dcl.ValueOrEmptyString(o.Message), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstancePreprocessDeleteRecipeStepsStatusDetailsToProto(&r)) } return p } // InstancePreprocessDeleteRecipeStepsStatusDetailsToProto converts a InstancePreprocessDeleteRecipeStepsStatusDetails resource to its proto representation. func Tier2AlphaInstancePreprocessDeleteRecipeStepsStatusDetailsToProto(o *alpha.InstancePreprocessDeleteRecipeStepsStatusDetails) *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsStatusDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsStatusDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstancePreprocessDeleteRecipeStepsQuotaRequestDeltasToProto converts a InstancePreprocessDeleteRecipeStepsQuotaRequestDeltas resource to its proto representation. func Tier2AlphaInstancePreprocessDeleteRecipeStepsQuotaRequestDeltasToProto(o *alpha.InstancePreprocessDeleteRecipeStepsQuotaRequestDeltas) *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsQuotaRequestDeltas { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsQuotaRequestDeltas{ MetricName: dcl.ValueOrEmptyString(o.MetricName), Amount: dcl.ValueOrEmptyInt64(o.Amount), QuotaLocationName: dcl.ValueOrEmptyString(o.QuotaLocationName), } return p } // InstancePreprocessDeleteRecipeStepsPreprocessUpdateToProto converts a InstancePreprocessDeleteRecipeStepsPreprocessUpdate resource to its proto representation. func Tier2AlphaInstancePreprocessDeleteRecipeStepsPreprocessUpdateToProto(o *alpha.InstancePreprocessDeleteRecipeStepsPreprocessUpdate) *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsPreprocessUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.ValueOrEmptyString(o.LatencySloBucketName), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), } return p } // InstancePreprocessDeleteRecipeStepsRequestedTenantProjectToProto converts a InstancePreprocessDeleteRecipeStepsRequestedTenantProject resource to its proto representation. func Tier2AlphaInstancePreprocessDeleteRecipeStepsRequestedTenantProjectToProto(o *alpha.InstancePreprocessDeleteRecipeStepsRequestedTenantProject) *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsRequestedTenantProject { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsRequestedTenantProject{ Tag: dcl.ValueOrEmptyString(o.Tag), Folder: dcl.ValueOrEmptyString(o.Folder), Scope: Tier2AlphaInstancePreprocessDeleteRecipeStepsRequestedTenantProjectScopeEnumToProto(o.Scope), } return p } // InstancePreprocessDeleteRecipeStepsPermissionsInfoToProto converts a InstancePreprocessDeleteRecipeStepsPermissionsInfo resource to its proto representation. func Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoToProto(o *alpha.InstancePreprocessDeleteRecipeStepsPermissionsInfo) *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfo{ PolicyName: Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyNameToProto(o.PolicyName), ResourcePath: dcl.ValueOrEmptyString(o.ResourcePath), ApiAttrs: Tier2AlphaInstanceGoogleprotobufstructToProto(o.ApiAttrs), PolicyNameMode: Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(o.PolicyNameMode), Resource: Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoResourceToProto(o.Resource), } for _, r := range o.IamPermissions { p.IamPermissions = append(p.IamPermissions, Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoIamPermissionsToProto(&r)) } return p } // InstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyNameToProto converts a InstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyName resource to its proto representation. func Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyNameToProto(o *alpha.InstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyName) *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyName { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoPolicyName{ Type: dcl.ValueOrEmptyString(o.Type), Id: dcl.ValueOrEmptyString(o.Id), Region: dcl.ValueOrEmptyString(o.Region), } return p } // InstancePreprocessDeleteRecipeStepsPermissionsInfoIamPermissionsToProto converts a InstancePreprocessDeleteRecipeStepsPermissionsInfoIamPermissions resource to its proto representation. func Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoIamPermissionsToProto(o *alpha.InstancePreprocessDeleteRecipeStepsPermissionsInfoIamPermissions) *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoIamPermissions { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.ValueOrEmptyString(o.Permission), } return p } // InstancePreprocessDeleteRecipeStepsPermissionsInfoResourceToProto converts a InstancePreprocessDeleteRecipeStepsPermissionsInfoResource resource to its proto representation. func Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoResourceToProto(o *alpha.InstancePreprocessDeleteRecipeStepsPermissionsInfoResource) *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoResource { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsPermissionsInfoResource{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), Service: dcl.ValueOrEmptyString(o.Service), } p.Labels = make(map[string]string) for k, r := range o.Labels { p.Labels[k] = r } return p } // InstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateToProto converts a InstancePreprocessDeleteRecipeStepsKeyNotificationsUpdate resource to its proto representation. func Tier2AlphaInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateToProto(o *alpha.InstancePreprocessDeleteRecipeStepsKeyNotificationsUpdate) *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: Tier2AlphaInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o.KeyNotificationsInfo), } return p } // InstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto converts a InstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource to its proto representation. func Tier2AlphaInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o *alpha.InstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.ValueOrEmptyInt64(o.DataVersion), Delegate: dcl.ValueOrEmptyString(o.Delegate), } for _, r := range o.KeyNotificationConfigs { p.KeyNotificationConfigs = append(p.KeyNotificationConfigs, Tier2AlphaInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(&r)) } return p } // InstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto converts a InstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource to its proto representation. func Tier2AlphaInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(o *alpha.InstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessDeleteRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.ValueOrEmptyString(o.KeyOrVersionName), Grant: dcl.ValueOrEmptyString(o.Grant), DelegatorGaiaId: dcl.ValueOrEmptyInt64(o.DelegatorGaiaId), } return p } // InstancePreprocessUpdateRecipeToProto converts a InstancePreprocessUpdateRecipe resource to its proto representation. func Tier2AlphaInstancePreprocessUpdateRecipeToProto(o *alpha.InstancePreprocessUpdateRecipe) *alphapb.Tier2AlphaInstancePreprocessUpdateRecipe { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUpdateRecipe{ HonorCancelRequest: dcl.ValueOrEmptyBool(o.HonorCancelRequest), IgnoreRecipeAfter: dcl.ValueOrEmptyInt64(o.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.ValueOrEmptyDouble(o.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.ValueOrEmptyBool(o.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.ValueOrEmptyString(o.ReadonlyRecipeStartTime), DelayToStoreResourcesInClhDbNanos: dcl.ValueOrEmptyInt64(o.DelayToStoreResourcesInClhDbNanos), } for _, r := range o.Steps { p.Steps = append(p.Steps, Tier2AlphaInstancePreprocessUpdateRecipeStepsToProto(&r)) } for _, r := range o.ResourceNamesStoredInClhWithDelay { p.ResourceNamesStoredInClhWithDelay = append(p.ResourceNamesStoredInClhWithDelay, r) } return p } // InstancePreprocessUpdateRecipeStepsToProto converts a InstancePreprocessUpdateRecipeSteps resource to its proto representation. func Tier2AlphaInstancePreprocessUpdateRecipeStepsToProto(o *alpha.InstancePreprocessUpdateRecipeSteps) *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeSteps { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUpdateRecipeSteps{ RelativeTime: dcl.ValueOrEmptyInt64(o.RelativeTime), SleepDuration: dcl.ValueOrEmptyInt64(o.SleepDuration), Action: Tier2AlphaInstancePreprocessUpdateRecipeStepsActionEnumToProto(o.Action), Status: Tier2AlphaInstancePreprocessUpdateRecipeStepsStatusToProto(o.Status), ErrorSpace: dcl.ValueOrEmptyString(o.ErrorSpace), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), ResourceMetadataSize: dcl.ValueOrEmptyInt64(o.ResourceMetadataSize), Description: dcl.ValueOrEmptyString(o.Description), UpdatedRepeatOperationDelaySec: dcl.ValueOrEmptyDouble(o.UpdatedRepeatOperationDelaySec), PreprocessUpdate: Tier2AlphaInstancePreprocessUpdateRecipeStepsPreprocessUpdateToProto(o.PreprocessUpdate), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), RequestedTenantProject: Tier2AlphaInstancePreprocessUpdateRecipeStepsRequestedTenantProjectToProto(o.RequestedTenantProject), KeyNotificationsUpdate: Tier2AlphaInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateToProto(o.KeyNotificationsUpdate), ClhDataUpdateTime: dcl.ValueOrEmptyString(o.ClhDataUpdateTime), PublicErrorMessage: dcl.ValueOrEmptyString(o.PublicErrorMessage), } for _, r := range o.QuotaRequestDeltas { p.QuotaRequestDeltas = append(p.QuotaRequestDeltas, Tier2AlphaInstancePreprocessUpdateRecipeStepsQuotaRequestDeltasToProto(&r)) } for _, r := range o.PermissionsInfo { p.PermissionsInfo = append(p.PermissionsInfo, Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoToProto(&r)) } return p } // InstancePreprocessUpdateRecipeStepsStatusToProto converts a InstancePreprocessUpdateRecipeStepsStatus resource to its proto representation. func Tier2AlphaInstancePreprocessUpdateRecipeStepsStatusToProto(o *alpha.InstancePreprocessUpdateRecipeStepsStatus) *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsStatus { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsStatus{ Code: dcl.ValueOrEmptyInt64(o.Code), Message: dcl.ValueOrEmptyString(o.Message), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstancePreprocessUpdateRecipeStepsStatusDetailsToProto(&r)) } return p } // InstancePreprocessUpdateRecipeStepsStatusDetailsToProto converts a InstancePreprocessUpdateRecipeStepsStatusDetails resource to its proto representation. func Tier2AlphaInstancePreprocessUpdateRecipeStepsStatusDetailsToProto(o *alpha.InstancePreprocessUpdateRecipeStepsStatusDetails) *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsStatusDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsStatusDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstancePreprocessUpdateRecipeStepsQuotaRequestDeltasToProto converts a InstancePreprocessUpdateRecipeStepsQuotaRequestDeltas resource to its proto representation. func Tier2AlphaInstancePreprocessUpdateRecipeStepsQuotaRequestDeltasToProto(o *alpha.InstancePreprocessUpdateRecipeStepsQuotaRequestDeltas) *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsQuotaRequestDeltas { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsQuotaRequestDeltas{ MetricName: dcl.ValueOrEmptyString(o.MetricName), Amount: dcl.ValueOrEmptyInt64(o.Amount), QuotaLocationName: dcl.ValueOrEmptyString(o.QuotaLocationName), } return p } // InstancePreprocessUpdateRecipeStepsPreprocessUpdateToProto converts a InstancePreprocessUpdateRecipeStepsPreprocessUpdate resource to its proto representation. func Tier2AlphaInstancePreprocessUpdateRecipeStepsPreprocessUpdateToProto(o *alpha.InstancePreprocessUpdateRecipeStepsPreprocessUpdate) *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsPreprocessUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.ValueOrEmptyString(o.LatencySloBucketName), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), } return p } // InstancePreprocessUpdateRecipeStepsRequestedTenantProjectToProto converts a InstancePreprocessUpdateRecipeStepsRequestedTenantProject resource to its proto representation. func Tier2AlphaInstancePreprocessUpdateRecipeStepsRequestedTenantProjectToProto(o *alpha.InstancePreprocessUpdateRecipeStepsRequestedTenantProject) *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsRequestedTenantProject { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsRequestedTenantProject{ Tag: dcl.ValueOrEmptyString(o.Tag), Folder: dcl.ValueOrEmptyString(o.Folder), Scope: Tier2AlphaInstancePreprocessUpdateRecipeStepsRequestedTenantProjectScopeEnumToProto(o.Scope), } return p } // InstancePreprocessUpdateRecipeStepsPermissionsInfoToProto converts a InstancePreprocessUpdateRecipeStepsPermissionsInfo resource to its proto representation. func Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoToProto(o *alpha.InstancePreprocessUpdateRecipeStepsPermissionsInfo) *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfo{ PolicyName: Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyNameToProto(o.PolicyName), ResourcePath: dcl.ValueOrEmptyString(o.ResourcePath), ApiAttrs: Tier2AlphaInstanceGoogleprotobufstructToProto(o.ApiAttrs), PolicyNameMode: Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(o.PolicyNameMode), Resource: Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoResourceToProto(o.Resource), } for _, r := range o.IamPermissions { p.IamPermissions = append(p.IamPermissions, Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoIamPermissionsToProto(&r)) } return p } // InstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyNameToProto converts a InstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyName resource to its proto representation. func Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyNameToProto(o *alpha.InstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyName) *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyName { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoPolicyName{ Type: dcl.ValueOrEmptyString(o.Type), Id: dcl.ValueOrEmptyString(o.Id), Region: dcl.ValueOrEmptyString(o.Region), } return p } // InstancePreprocessUpdateRecipeStepsPermissionsInfoIamPermissionsToProto converts a InstancePreprocessUpdateRecipeStepsPermissionsInfoIamPermissions resource to its proto representation. func Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoIamPermissionsToProto(o *alpha.InstancePreprocessUpdateRecipeStepsPermissionsInfoIamPermissions) *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoIamPermissions { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.ValueOrEmptyString(o.Permission), } return p } // InstancePreprocessUpdateRecipeStepsPermissionsInfoResourceToProto converts a InstancePreprocessUpdateRecipeStepsPermissionsInfoResource resource to its proto representation. func Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoResourceToProto(o *alpha.InstancePreprocessUpdateRecipeStepsPermissionsInfoResource) *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoResource { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsPermissionsInfoResource{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), Service: dcl.ValueOrEmptyString(o.Service), } p.Labels = make(map[string]string) for k, r := range o.Labels { p.Labels[k] = r } return p } // InstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateToProto converts a InstancePreprocessUpdateRecipeStepsKeyNotificationsUpdate resource to its proto representation. func Tier2AlphaInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateToProto(o *alpha.InstancePreprocessUpdateRecipeStepsKeyNotificationsUpdate) *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: Tier2AlphaInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o.KeyNotificationsInfo), } return p } // InstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto converts a InstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource to its proto representation. func Tier2AlphaInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o *alpha.InstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.ValueOrEmptyInt64(o.DataVersion), Delegate: dcl.ValueOrEmptyString(o.Delegate), } for _, r := range o.KeyNotificationConfigs { p.KeyNotificationConfigs = append(p.KeyNotificationConfigs, Tier2AlphaInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(&r)) } return p } // InstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto converts a InstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource to its proto representation. func Tier2AlphaInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(o *alpha.InstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUpdateRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.ValueOrEmptyString(o.KeyOrVersionName), Grant: dcl.ValueOrEmptyString(o.Grant), DelegatorGaiaId: dcl.ValueOrEmptyInt64(o.DelegatorGaiaId), } return p } // InstancePreprocessFreezeRecipeToProto converts a InstancePreprocessFreezeRecipe resource to its proto representation. func Tier2AlphaInstancePreprocessFreezeRecipeToProto(o *alpha.InstancePreprocessFreezeRecipe) *alphapb.Tier2AlphaInstancePreprocessFreezeRecipe { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessFreezeRecipe{ HonorCancelRequest: dcl.ValueOrEmptyBool(o.HonorCancelRequest), IgnoreRecipeAfter: dcl.ValueOrEmptyInt64(o.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.ValueOrEmptyDouble(o.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.ValueOrEmptyBool(o.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.ValueOrEmptyString(o.ReadonlyRecipeStartTime), DelayToStoreResourcesInClhDbNanos: dcl.ValueOrEmptyInt64(o.DelayToStoreResourcesInClhDbNanos), } for _, r := range o.Steps { p.Steps = append(p.Steps, Tier2AlphaInstancePreprocessFreezeRecipeStepsToProto(&r)) } for _, r := range o.ResourceNamesStoredInClhWithDelay { p.ResourceNamesStoredInClhWithDelay = append(p.ResourceNamesStoredInClhWithDelay, r) } return p } // InstancePreprocessFreezeRecipeStepsToProto converts a InstancePreprocessFreezeRecipeSteps resource to its proto representation. func Tier2AlphaInstancePreprocessFreezeRecipeStepsToProto(o *alpha.InstancePreprocessFreezeRecipeSteps) *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeSteps { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessFreezeRecipeSteps{ RelativeTime: dcl.ValueOrEmptyInt64(o.RelativeTime), SleepDuration: dcl.ValueOrEmptyInt64(o.SleepDuration), Action: Tier2AlphaInstancePreprocessFreezeRecipeStepsActionEnumToProto(o.Action), Status: Tier2AlphaInstancePreprocessFreezeRecipeStepsStatusToProto(o.Status), ErrorSpace: dcl.ValueOrEmptyString(o.ErrorSpace), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), ResourceMetadataSize: dcl.ValueOrEmptyInt64(o.ResourceMetadataSize), Description: dcl.ValueOrEmptyString(o.Description), UpdatedRepeatOperationDelaySec: dcl.ValueOrEmptyDouble(o.UpdatedRepeatOperationDelaySec), PreprocessUpdate: Tier2AlphaInstancePreprocessFreezeRecipeStepsPreprocessUpdateToProto(o.PreprocessUpdate), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), RequestedTenantProject: Tier2AlphaInstancePreprocessFreezeRecipeStepsRequestedTenantProjectToProto(o.RequestedTenantProject), KeyNotificationsUpdate: Tier2AlphaInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateToProto(o.KeyNotificationsUpdate), ClhDataUpdateTime: dcl.ValueOrEmptyString(o.ClhDataUpdateTime), PublicErrorMessage: dcl.ValueOrEmptyString(o.PublicErrorMessage), } for _, r := range o.QuotaRequestDeltas { p.QuotaRequestDeltas = append(p.QuotaRequestDeltas, Tier2AlphaInstancePreprocessFreezeRecipeStepsQuotaRequestDeltasToProto(&r)) } for _, r := range o.PermissionsInfo { p.PermissionsInfo = append(p.PermissionsInfo, Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoToProto(&r)) } return p } // InstancePreprocessFreezeRecipeStepsStatusToProto converts a InstancePreprocessFreezeRecipeStepsStatus resource to its proto representation. func Tier2AlphaInstancePreprocessFreezeRecipeStepsStatusToProto(o *alpha.InstancePreprocessFreezeRecipeStepsStatus) *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsStatus { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsStatus{ Code: dcl.ValueOrEmptyInt64(o.Code), Message: dcl.ValueOrEmptyString(o.Message), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstancePreprocessFreezeRecipeStepsStatusDetailsToProto(&r)) } return p } // InstancePreprocessFreezeRecipeStepsStatusDetailsToProto converts a InstancePreprocessFreezeRecipeStepsStatusDetails resource to its proto representation. func Tier2AlphaInstancePreprocessFreezeRecipeStepsStatusDetailsToProto(o *alpha.InstancePreprocessFreezeRecipeStepsStatusDetails) *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsStatusDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsStatusDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstancePreprocessFreezeRecipeStepsQuotaRequestDeltasToProto converts a InstancePreprocessFreezeRecipeStepsQuotaRequestDeltas resource to its proto representation. func Tier2AlphaInstancePreprocessFreezeRecipeStepsQuotaRequestDeltasToProto(o *alpha.InstancePreprocessFreezeRecipeStepsQuotaRequestDeltas) *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsQuotaRequestDeltas { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsQuotaRequestDeltas{ MetricName: dcl.ValueOrEmptyString(o.MetricName), Amount: dcl.ValueOrEmptyInt64(o.Amount), QuotaLocationName: dcl.ValueOrEmptyString(o.QuotaLocationName), } return p } // InstancePreprocessFreezeRecipeStepsPreprocessUpdateToProto converts a InstancePreprocessFreezeRecipeStepsPreprocessUpdate resource to its proto representation. func Tier2AlphaInstancePreprocessFreezeRecipeStepsPreprocessUpdateToProto(o *alpha.InstancePreprocessFreezeRecipeStepsPreprocessUpdate) *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsPreprocessUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.ValueOrEmptyString(o.LatencySloBucketName), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), } return p } // InstancePreprocessFreezeRecipeStepsRequestedTenantProjectToProto converts a InstancePreprocessFreezeRecipeStepsRequestedTenantProject resource to its proto representation. func Tier2AlphaInstancePreprocessFreezeRecipeStepsRequestedTenantProjectToProto(o *alpha.InstancePreprocessFreezeRecipeStepsRequestedTenantProject) *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsRequestedTenantProject { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsRequestedTenantProject{ Tag: dcl.ValueOrEmptyString(o.Tag), Folder: dcl.ValueOrEmptyString(o.Folder), Scope: Tier2AlphaInstancePreprocessFreezeRecipeStepsRequestedTenantProjectScopeEnumToProto(o.Scope), } return p } // InstancePreprocessFreezeRecipeStepsPermissionsInfoToProto converts a InstancePreprocessFreezeRecipeStepsPermissionsInfo resource to its proto representation. func Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoToProto(o *alpha.InstancePreprocessFreezeRecipeStepsPermissionsInfo) *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfo{ PolicyName: Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyNameToProto(o.PolicyName), ResourcePath: dcl.ValueOrEmptyString(o.ResourcePath), ApiAttrs: Tier2AlphaInstanceGoogleprotobufstructToProto(o.ApiAttrs), PolicyNameMode: Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(o.PolicyNameMode), Resource: Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoResourceToProto(o.Resource), } for _, r := range o.IamPermissions { p.IamPermissions = append(p.IamPermissions, Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoIamPermissionsToProto(&r)) } return p } // InstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyNameToProto converts a InstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyName resource to its proto representation. func Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyNameToProto(o *alpha.InstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyName) *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyName { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoPolicyName{ Type: dcl.ValueOrEmptyString(o.Type), Id: dcl.ValueOrEmptyString(o.Id), Region: dcl.ValueOrEmptyString(o.Region), } return p } // InstancePreprocessFreezeRecipeStepsPermissionsInfoIamPermissionsToProto converts a InstancePreprocessFreezeRecipeStepsPermissionsInfoIamPermissions resource to its proto representation. func Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoIamPermissionsToProto(o *alpha.InstancePreprocessFreezeRecipeStepsPermissionsInfoIamPermissions) *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoIamPermissions { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.ValueOrEmptyString(o.Permission), } return p } // InstancePreprocessFreezeRecipeStepsPermissionsInfoResourceToProto converts a InstancePreprocessFreezeRecipeStepsPermissionsInfoResource resource to its proto representation. func Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoResourceToProto(o *alpha.InstancePreprocessFreezeRecipeStepsPermissionsInfoResource) *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoResource { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsPermissionsInfoResource{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), Service: dcl.ValueOrEmptyString(o.Service), } p.Labels = make(map[string]string) for k, r := range o.Labels { p.Labels[k] = r } return p } // InstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateToProto converts a InstancePreprocessFreezeRecipeStepsKeyNotificationsUpdate resource to its proto representation. func Tier2AlphaInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateToProto(o *alpha.InstancePreprocessFreezeRecipeStepsKeyNotificationsUpdate) *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: Tier2AlphaInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o.KeyNotificationsInfo), } return p } // InstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto converts a InstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource to its proto representation. func Tier2AlphaInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o *alpha.InstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.ValueOrEmptyInt64(o.DataVersion), Delegate: dcl.ValueOrEmptyString(o.Delegate), } for _, r := range o.KeyNotificationConfigs { p.KeyNotificationConfigs = append(p.KeyNotificationConfigs, Tier2AlphaInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(&r)) } return p } // InstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto converts a InstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource to its proto representation. func Tier2AlphaInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(o *alpha.InstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.ValueOrEmptyString(o.KeyOrVersionName), Grant: dcl.ValueOrEmptyString(o.Grant), DelegatorGaiaId: dcl.ValueOrEmptyInt64(o.DelegatorGaiaId), } return p } // InstanceFreezeRecipeToProto converts a InstanceFreezeRecipe resource to its proto representation. func Tier2AlphaInstanceFreezeRecipeToProto(o *alpha.InstanceFreezeRecipe) *alphapb.Tier2AlphaInstanceFreezeRecipe { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceFreezeRecipe{ HonorCancelRequest: dcl.ValueOrEmptyBool(o.HonorCancelRequest), IgnoreRecipeAfter: dcl.ValueOrEmptyInt64(o.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.ValueOrEmptyDouble(o.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.ValueOrEmptyBool(o.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.ValueOrEmptyString(o.ReadonlyRecipeStartTime), DelayToStoreResourcesInClhDbNanos: dcl.ValueOrEmptyInt64(o.DelayToStoreResourcesInClhDbNanos), } for _, r := range o.Steps { p.Steps = append(p.Steps, Tier2AlphaInstanceFreezeRecipeStepsToProto(&r)) } for _, r := range o.ResourceNamesStoredInClhWithDelay { p.ResourceNamesStoredInClhWithDelay = append(p.ResourceNamesStoredInClhWithDelay, r) } return p } // InstanceFreezeRecipeStepsToProto converts a InstanceFreezeRecipeSteps resource to its proto representation. func Tier2AlphaInstanceFreezeRecipeStepsToProto(o *alpha.InstanceFreezeRecipeSteps) *alphapb.Tier2AlphaInstanceFreezeRecipeSteps { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceFreezeRecipeSteps{ RelativeTime: dcl.ValueOrEmptyInt64(o.RelativeTime), SleepDuration: dcl.ValueOrEmptyInt64(o.SleepDuration), Action: Tier2AlphaInstanceFreezeRecipeStepsActionEnumToProto(o.Action), Status: Tier2AlphaInstanceFreezeRecipeStepsStatusToProto(o.Status), ErrorSpace: dcl.ValueOrEmptyString(o.ErrorSpace), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), ResourceMetadataSize: dcl.ValueOrEmptyInt64(o.ResourceMetadataSize), Description: dcl.ValueOrEmptyString(o.Description), UpdatedRepeatOperationDelaySec: dcl.ValueOrEmptyDouble(o.UpdatedRepeatOperationDelaySec), PreprocessUpdate: Tier2AlphaInstanceFreezeRecipeStepsPreprocessUpdateToProto(o.PreprocessUpdate), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), RequestedTenantProject: Tier2AlphaInstanceFreezeRecipeStepsRequestedTenantProjectToProto(o.RequestedTenantProject), KeyNotificationsUpdate: Tier2AlphaInstanceFreezeRecipeStepsKeyNotificationsUpdateToProto(o.KeyNotificationsUpdate), ClhDataUpdateTime: dcl.ValueOrEmptyString(o.ClhDataUpdateTime), PublicErrorMessage: dcl.ValueOrEmptyString(o.PublicErrorMessage), } for _, r := range o.QuotaRequestDeltas { p.QuotaRequestDeltas = append(p.QuotaRequestDeltas, Tier2AlphaInstanceFreezeRecipeStepsQuotaRequestDeltasToProto(&r)) } for _, r := range o.PermissionsInfo { p.PermissionsInfo = append(p.PermissionsInfo, Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoToProto(&r)) } return p } // InstanceFreezeRecipeStepsStatusToProto converts a InstanceFreezeRecipeStepsStatus resource to its proto representation. func Tier2AlphaInstanceFreezeRecipeStepsStatusToProto(o *alpha.InstanceFreezeRecipeStepsStatus) *alphapb.Tier2AlphaInstanceFreezeRecipeStepsStatus { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceFreezeRecipeStepsStatus{ Code: dcl.ValueOrEmptyInt64(o.Code), Message: dcl.ValueOrEmptyString(o.Message), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstanceFreezeRecipeStepsStatusDetailsToProto(&r)) } return p } // InstanceFreezeRecipeStepsStatusDetailsToProto converts a InstanceFreezeRecipeStepsStatusDetails resource to its proto representation. func Tier2AlphaInstanceFreezeRecipeStepsStatusDetailsToProto(o *alpha.InstanceFreezeRecipeStepsStatusDetails) *alphapb.Tier2AlphaInstanceFreezeRecipeStepsStatusDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceFreezeRecipeStepsStatusDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstanceFreezeRecipeStepsQuotaRequestDeltasToProto converts a InstanceFreezeRecipeStepsQuotaRequestDeltas resource to its proto representation. func Tier2AlphaInstanceFreezeRecipeStepsQuotaRequestDeltasToProto(o *alpha.InstanceFreezeRecipeStepsQuotaRequestDeltas) *alphapb.Tier2AlphaInstanceFreezeRecipeStepsQuotaRequestDeltas { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceFreezeRecipeStepsQuotaRequestDeltas{ MetricName: dcl.ValueOrEmptyString(o.MetricName), Amount: dcl.ValueOrEmptyInt64(o.Amount), QuotaLocationName: dcl.ValueOrEmptyString(o.QuotaLocationName), } return p } // InstanceFreezeRecipeStepsPreprocessUpdateToProto converts a InstanceFreezeRecipeStepsPreprocessUpdate resource to its proto representation. func Tier2AlphaInstanceFreezeRecipeStepsPreprocessUpdateToProto(o *alpha.InstanceFreezeRecipeStepsPreprocessUpdate) *alphapb.Tier2AlphaInstanceFreezeRecipeStepsPreprocessUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceFreezeRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.ValueOrEmptyString(o.LatencySloBucketName), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), } return p } // InstanceFreezeRecipeStepsRequestedTenantProjectToProto converts a InstanceFreezeRecipeStepsRequestedTenantProject resource to its proto representation. func Tier2AlphaInstanceFreezeRecipeStepsRequestedTenantProjectToProto(o *alpha.InstanceFreezeRecipeStepsRequestedTenantProject) *alphapb.Tier2AlphaInstanceFreezeRecipeStepsRequestedTenantProject { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceFreezeRecipeStepsRequestedTenantProject{ Tag: dcl.ValueOrEmptyString(o.Tag), Folder: dcl.ValueOrEmptyString(o.Folder), Scope: Tier2AlphaInstanceFreezeRecipeStepsRequestedTenantProjectScopeEnumToProto(o.Scope), } return p } // InstanceFreezeRecipeStepsPermissionsInfoToProto converts a InstanceFreezeRecipeStepsPermissionsInfo resource to its proto representation. func Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoToProto(o *alpha.InstanceFreezeRecipeStepsPermissionsInfo) *alphapb.Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfo{ PolicyName: Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoPolicyNameToProto(o.PolicyName), ResourcePath: dcl.ValueOrEmptyString(o.ResourcePath), ApiAttrs: Tier2AlphaInstanceGoogleprotobufstructToProto(o.ApiAttrs), PolicyNameMode: Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(o.PolicyNameMode), Resource: Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoResourceToProto(o.Resource), } for _, r := range o.IamPermissions { p.IamPermissions = append(p.IamPermissions, Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoIamPermissionsToProto(&r)) } return p } // InstanceFreezeRecipeStepsPermissionsInfoPolicyNameToProto converts a InstanceFreezeRecipeStepsPermissionsInfoPolicyName resource to its proto representation. func Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoPolicyNameToProto(o *alpha.InstanceFreezeRecipeStepsPermissionsInfoPolicyName) *alphapb.Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoPolicyName { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoPolicyName{ Type: dcl.ValueOrEmptyString(o.Type), Id: dcl.ValueOrEmptyString(o.Id), Region: dcl.ValueOrEmptyString(o.Region), } return p } // InstanceFreezeRecipeStepsPermissionsInfoIamPermissionsToProto converts a InstanceFreezeRecipeStepsPermissionsInfoIamPermissions resource to its proto representation. func Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoIamPermissionsToProto(o *alpha.InstanceFreezeRecipeStepsPermissionsInfoIamPermissions) *alphapb.Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoIamPermissions { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.ValueOrEmptyString(o.Permission), } return p } // InstanceFreezeRecipeStepsPermissionsInfoResourceToProto converts a InstanceFreezeRecipeStepsPermissionsInfoResource resource to its proto representation. func Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoResourceToProto(o *alpha.InstanceFreezeRecipeStepsPermissionsInfoResource) *alphapb.Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoResource { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceFreezeRecipeStepsPermissionsInfoResource{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), Service: dcl.ValueOrEmptyString(o.Service), } p.Labels = make(map[string]string) for k, r := range o.Labels { p.Labels[k] = r } return p } // InstanceFreezeRecipeStepsKeyNotificationsUpdateToProto converts a InstanceFreezeRecipeStepsKeyNotificationsUpdate resource to its proto representation. func Tier2AlphaInstanceFreezeRecipeStepsKeyNotificationsUpdateToProto(o *alpha.InstanceFreezeRecipeStepsKeyNotificationsUpdate) *alphapb.Tier2AlphaInstanceFreezeRecipeStepsKeyNotificationsUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceFreezeRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: Tier2AlphaInstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o.KeyNotificationsInfo), } return p } // InstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto converts a InstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource to its proto representation. func Tier2AlphaInstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o *alpha.InstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alphapb.Tier2AlphaInstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.ValueOrEmptyInt64(o.DataVersion), Delegate: dcl.ValueOrEmptyString(o.Delegate), } for _, r := range o.KeyNotificationConfigs { p.KeyNotificationConfigs = append(p.KeyNotificationConfigs, Tier2AlphaInstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(&r)) } return p } // InstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto converts a InstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource to its proto representation. func Tier2AlphaInstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(o *alpha.InstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alphapb.Tier2AlphaInstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceFreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.ValueOrEmptyString(o.KeyOrVersionName), Grant: dcl.ValueOrEmptyString(o.Grant), DelegatorGaiaId: dcl.ValueOrEmptyInt64(o.DelegatorGaiaId), } return p } // InstancePreprocessUnfreezeRecipeToProto converts a InstancePreprocessUnfreezeRecipe resource to its proto representation. func Tier2AlphaInstancePreprocessUnfreezeRecipeToProto(o *alpha.InstancePreprocessUnfreezeRecipe) *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipe { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipe{ HonorCancelRequest: dcl.ValueOrEmptyBool(o.HonorCancelRequest), IgnoreRecipeAfter: dcl.ValueOrEmptyInt64(o.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.ValueOrEmptyDouble(o.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.ValueOrEmptyBool(o.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.ValueOrEmptyString(o.ReadonlyRecipeStartTime), DelayToStoreResourcesInClhDbNanos: dcl.ValueOrEmptyInt64(o.DelayToStoreResourcesInClhDbNanos), } for _, r := range o.Steps { p.Steps = append(p.Steps, Tier2AlphaInstancePreprocessUnfreezeRecipeStepsToProto(&r)) } for _, r := range o.ResourceNamesStoredInClhWithDelay { p.ResourceNamesStoredInClhWithDelay = append(p.ResourceNamesStoredInClhWithDelay, r) } return p } // InstancePreprocessUnfreezeRecipeStepsToProto converts a InstancePreprocessUnfreezeRecipeSteps resource to its proto representation. func Tier2AlphaInstancePreprocessUnfreezeRecipeStepsToProto(o *alpha.InstancePreprocessUnfreezeRecipeSteps) *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeSteps { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeSteps{ RelativeTime: dcl.ValueOrEmptyInt64(o.RelativeTime), SleepDuration: dcl.ValueOrEmptyInt64(o.SleepDuration), Action: Tier2AlphaInstancePreprocessUnfreezeRecipeStepsActionEnumToProto(o.Action), Status: Tier2AlphaInstancePreprocessUnfreezeRecipeStepsStatusToProto(o.Status), ErrorSpace: dcl.ValueOrEmptyString(o.ErrorSpace), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), ResourceMetadataSize: dcl.ValueOrEmptyInt64(o.ResourceMetadataSize), Description: dcl.ValueOrEmptyString(o.Description), UpdatedRepeatOperationDelaySec: dcl.ValueOrEmptyDouble(o.UpdatedRepeatOperationDelaySec), PreprocessUpdate: Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPreprocessUpdateToProto(o.PreprocessUpdate), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), RequestedTenantProject: Tier2AlphaInstancePreprocessUnfreezeRecipeStepsRequestedTenantProjectToProto(o.RequestedTenantProject), KeyNotificationsUpdate: Tier2AlphaInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateToProto(o.KeyNotificationsUpdate), ClhDataUpdateTime: dcl.ValueOrEmptyString(o.ClhDataUpdateTime), PublicErrorMessage: dcl.ValueOrEmptyString(o.PublicErrorMessage), } for _, r := range o.QuotaRequestDeltas { p.QuotaRequestDeltas = append(p.QuotaRequestDeltas, Tier2AlphaInstancePreprocessUnfreezeRecipeStepsQuotaRequestDeltasToProto(&r)) } for _, r := range o.PermissionsInfo { p.PermissionsInfo = append(p.PermissionsInfo, Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoToProto(&r)) } return p } // InstancePreprocessUnfreezeRecipeStepsStatusToProto converts a InstancePreprocessUnfreezeRecipeStepsStatus resource to its proto representation. func Tier2AlphaInstancePreprocessUnfreezeRecipeStepsStatusToProto(o *alpha.InstancePreprocessUnfreezeRecipeStepsStatus) *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsStatus { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsStatus{ Code: dcl.ValueOrEmptyInt64(o.Code), Message: dcl.ValueOrEmptyString(o.Message), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstancePreprocessUnfreezeRecipeStepsStatusDetailsToProto(&r)) } return p } // InstancePreprocessUnfreezeRecipeStepsStatusDetailsToProto converts a InstancePreprocessUnfreezeRecipeStepsStatusDetails resource to its proto representation. func Tier2AlphaInstancePreprocessUnfreezeRecipeStepsStatusDetailsToProto(o *alpha.InstancePreprocessUnfreezeRecipeStepsStatusDetails) *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsStatusDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsStatusDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstancePreprocessUnfreezeRecipeStepsQuotaRequestDeltasToProto converts a InstancePreprocessUnfreezeRecipeStepsQuotaRequestDeltas resource to its proto representation. func Tier2AlphaInstancePreprocessUnfreezeRecipeStepsQuotaRequestDeltasToProto(o *alpha.InstancePreprocessUnfreezeRecipeStepsQuotaRequestDeltas) *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsQuotaRequestDeltas { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsQuotaRequestDeltas{ MetricName: dcl.ValueOrEmptyString(o.MetricName), Amount: dcl.ValueOrEmptyInt64(o.Amount), QuotaLocationName: dcl.ValueOrEmptyString(o.QuotaLocationName), } return p } // InstancePreprocessUnfreezeRecipeStepsPreprocessUpdateToProto converts a InstancePreprocessUnfreezeRecipeStepsPreprocessUpdate resource to its proto representation. func Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPreprocessUpdateToProto(o *alpha.InstancePreprocessUnfreezeRecipeStepsPreprocessUpdate) *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPreprocessUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.ValueOrEmptyString(o.LatencySloBucketName), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), } return p } // InstancePreprocessUnfreezeRecipeStepsRequestedTenantProjectToProto converts a InstancePreprocessUnfreezeRecipeStepsRequestedTenantProject resource to its proto representation. func Tier2AlphaInstancePreprocessUnfreezeRecipeStepsRequestedTenantProjectToProto(o *alpha.InstancePreprocessUnfreezeRecipeStepsRequestedTenantProject) *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsRequestedTenantProject { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsRequestedTenantProject{ Tag: dcl.ValueOrEmptyString(o.Tag), Folder: dcl.ValueOrEmptyString(o.Folder), Scope: Tier2AlphaInstancePreprocessUnfreezeRecipeStepsRequestedTenantProjectScopeEnumToProto(o.Scope), } return p } // InstancePreprocessUnfreezeRecipeStepsPermissionsInfoToProto converts a InstancePreprocessUnfreezeRecipeStepsPermissionsInfo resource to its proto representation. func Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoToProto(o *alpha.InstancePreprocessUnfreezeRecipeStepsPermissionsInfo) *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfo{ PolicyName: Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyNameToProto(o.PolicyName), ResourcePath: dcl.ValueOrEmptyString(o.ResourcePath), ApiAttrs: Tier2AlphaInstanceGoogleprotobufstructToProto(o.ApiAttrs), PolicyNameMode: Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(o.PolicyNameMode), Resource: Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoResourceToProto(o.Resource), } for _, r := range o.IamPermissions { p.IamPermissions = append(p.IamPermissions, Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoIamPermissionsToProto(&r)) } return p } // InstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyNameToProto converts a InstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyName resource to its proto representation. func Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyNameToProto(o *alpha.InstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyName) *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyName { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoPolicyName{ Type: dcl.ValueOrEmptyString(o.Type), Id: dcl.ValueOrEmptyString(o.Id), Region: dcl.ValueOrEmptyString(o.Region), } return p } // InstancePreprocessUnfreezeRecipeStepsPermissionsInfoIamPermissionsToProto converts a InstancePreprocessUnfreezeRecipeStepsPermissionsInfoIamPermissions resource to its proto representation. func Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoIamPermissionsToProto(o *alpha.InstancePreprocessUnfreezeRecipeStepsPermissionsInfoIamPermissions) *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoIamPermissions { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.ValueOrEmptyString(o.Permission), } return p } // InstancePreprocessUnfreezeRecipeStepsPermissionsInfoResourceToProto converts a InstancePreprocessUnfreezeRecipeStepsPermissionsInfoResource resource to its proto representation. func Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoResourceToProto(o *alpha.InstancePreprocessUnfreezeRecipeStepsPermissionsInfoResource) *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoResource { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsPermissionsInfoResource{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), Service: dcl.ValueOrEmptyString(o.Service), } p.Labels = make(map[string]string) for k, r := range o.Labels { p.Labels[k] = r } return p } // InstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateToProto converts a InstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdate resource to its proto representation. func Tier2AlphaInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateToProto(o *alpha.InstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdate) *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: Tier2AlphaInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o.KeyNotificationsInfo), } return p } // InstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto converts a InstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource to its proto representation. func Tier2AlphaInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o *alpha.InstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.ValueOrEmptyInt64(o.DataVersion), Delegate: dcl.ValueOrEmptyString(o.Delegate), } for _, r := range o.KeyNotificationConfigs { p.KeyNotificationConfigs = append(p.KeyNotificationConfigs, Tier2AlphaInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(&r)) } return p } // InstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto converts a InstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource to its proto representation. func Tier2AlphaInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(o *alpha.InstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.ValueOrEmptyString(o.KeyOrVersionName), Grant: dcl.ValueOrEmptyString(o.Grant), DelegatorGaiaId: dcl.ValueOrEmptyInt64(o.DelegatorGaiaId), } return p } // InstanceUnfreezeRecipeToProto converts a InstanceUnfreezeRecipe resource to its proto representation. func Tier2AlphaInstanceUnfreezeRecipeToProto(o *alpha.InstanceUnfreezeRecipe) *alphapb.Tier2AlphaInstanceUnfreezeRecipe { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUnfreezeRecipe{ HonorCancelRequest: dcl.ValueOrEmptyBool(o.HonorCancelRequest), IgnoreRecipeAfter: dcl.ValueOrEmptyInt64(o.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.ValueOrEmptyDouble(o.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.ValueOrEmptyBool(o.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.ValueOrEmptyString(o.ReadonlyRecipeStartTime), DelayToStoreResourcesInClhDbNanos: dcl.ValueOrEmptyInt64(o.DelayToStoreResourcesInClhDbNanos), } for _, r := range o.Steps { p.Steps = append(p.Steps, Tier2AlphaInstanceUnfreezeRecipeStepsToProto(&r)) } for _, r := range o.ResourceNamesStoredInClhWithDelay { p.ResourceNamesStoredInClhWithDelay = append(p.ResourceNamesStoredInClhWithDelay, r) } return p } // InstanceUnfreezeRecipeStepsToProto converts a InstanceUnfreezeRecipeSteps resource to its proto representation. func Tier2AlphaInstanceUnfreezeRecipeStepsToProto(o *alpha.InstanceUnfreezeRecipeSteps) *alphapb.Tier2AlphaInstanceUnfreezeRecipeSteps { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUnfreezeRecipeSteps{ RelativeTime: dcl.ValueOrEmptyInt64(o.RelativeTime), SleepDuration: dcl.ValueOrEmptyInt64(o.SleepDuration), Action: Tier2AlphaInstanceUnfreezeRecipeStepsActionEnumToProto(o.Action), Status: Tier2AlphaInstanceUnfreezeRecipeStepsStatusToProto(o.Status), ErrorSpace: dcl.ValueOrEmptyString(o.ErrorSpace), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), ResourceMetadataSize: dcl.ValueOrEmptyInt64(o.ResourceMetadataSize), Description: dcl.ValueOrEmptyString(o.Description), UpdatedRepeatOperationDelaySec: dcl.ValueOrEmptyDouble(o.UpdatedRepeatOperationDelaySec), PreprocessUpdate: Tier2AlphaInstanceUnfreezeRecipeStepsPreprocessUpdateToProto(o.PreprocessUpdate), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), RequestedTenantProject: Tier2AlphaInstanceUnfreezeRecipeStepsRequestedTenantProjectToProto(o.RequestedTenantProject), KeyNotificationsUpdate: Tier2AlphaInstanceUnfreezeRecipeStepsKeyNotificationsUpdateToProto(o.KeyNotificationsUpdate), ClhDataUpdateTime: dcl.ValueOrEmptyString(o.ClhDataUpdateTime), PublicErrorMessage: dcl.ValueOrEmptyString(o.PublicErrorMessage), } for _, r := range o.QuotaRequestDeltas { p.QuotaRequestDeltas = append(p.QuotaRequestDeltas, Tier2AlphaInstanceUnfreezeRecipeStepsQuotaRequestDeltasToProto(&r)) } for _, r := range o.PermissionsInfo { p.PermissionsInfo = append(p.PermissionsInfo, Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoToProto(&r)) } return p } // InstanceUnfreezeRecipeStepsStatusToProto converts a InstanceUnfreezeRecipeStepsStatus resource to its proto representation. func Tier2AlphaInstanceUnfreezeRecipeStepsStatusToProto(o *alpha.InstanceUnfreezeRecipeStepsStatus) *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsStatus { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsStatus{ Code: dcl.ValueOrEmptyInt64(o.Code), Message: dcl.ValueOrEmptyString(o.Message), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstanceUnfreezeRecipeStepsStatusDetailsToProto(&r)) } return p } // InstanceUnfreezeRecipeStepsStatusDetailsToProto converts a InstanceUnfreezeRecipeStepsStatusDetails resource to its proto representation. func Tier2AlphaInstanceUnfreezeRecipeStepsStatusDetailsToProto(o *alpha.InstanceUnfreezeRecipeStepsStatusDetails) *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsStatusDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsStatusDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstanceUnfreezeRecipeStepsQuotaRequestDeltasToProto converts a InstanceUnfreezeRecipeStepsQuotaRequestDeltas resource to its proto representation. func Tier2AlphaInstanceUnfreezeRecipeStepsQuotaRequestDeltasToProto(o *alpha.InstanceUnfreezeRecipeStepsQuotaRequestDeltas) *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsQuotaRequestDeltas { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsQuotaRequestDeltas{ MetricName: dcl.ValueOrEmptyString(o.MetricName), Amount: dcl.ValueOrEmptyInt64(o.Amount), QuotaLocationName: dcl.ValueOrEmptyString(o.QuotaLocationName), } return p } // InstanceUnfreezeRecipeStepsPreprocessUpdateToProto converts a InstanceUnfreezeRecipeStepsPreprocessUpdate resource to its proto representation. func Tier2AlphaInstanceUnfreezeRecipeStepsPreprocessUpdateToProto(o *alpha.InstanceUnfreezeRecipeStepsPreprocessUpdate) *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsPreprocessUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.ValueOrEmptyString(o.LatencySloBucketName), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), } return p } // InstanceUnfreezeRecipeStepsRequestedTenantProjectToProto converts a InstanceUnfreezeRecipeStepsRequestedTenantProject resource to its proto representation. func Tier2AlphaInstanceUnfreezeRecipeStepsRequestedTenantProjectToProto(o *alpha.InstanceUnfreezeRecipeStepsRequestedTenantProject) *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsRequestedTenantProject { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsRequestedTenantProject{ Tag: dcl.ValueOrEmptyString(o.Tag), Folder: dcl.ValueOrEmptyString(o.Folder), Scope: Tier2AlphaInstanceUnfreezeRecipeStepsRequestedTenantProjectScopeEnumToProto(o.Scope), } return p } // InstanceUnfreezeRecipeStepsPermissionsInfoToProto converts a InstanceUnfreezeRecipeStepsPermissionsInfo resource to its proto representation. func Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoToProto(o *alpha.InstanceUnfreezeRecipeStepsPermissionsInfo) *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfo{ PolicyName: Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoPolicyNameToProto(o.PolicyName), ResourcePath: dcl.ValueOrEmptyString(o.ResourcePath), ApiAttrs: Tier2AlphaInstanceGoogleprotobufstructToProto(o.ApiAttrs), PolicyNameMode: Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(o.PolicyNameMode), Resource: Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoResourceToProto(o.Resource), } for _, r := range o.IamPermissions { p.IamPermissions = append(p.IamPermissions, Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoIamPermissionsToProto(&r)) } return p } // InstanceUnfreezeRecipeStepsPermissionsInfoPolicyNameToProto converts a InstanceUnfreezeRecipeStepsPermissionsInfoPolicyName resource to its proto representation. func Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoPolicyNameToProto(o *alpha.InstanceUnfreezeRecipeStepsPermissionsInfoPolicyName) *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoPolicyName { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoPolicyName{ Type: dcl.ValueOrEmptyString(o.Type), Id: dcl.ValueOrEmptyString(o.Id), Region: dcl.ValueOrEmptyString(o.Region), } return p } // InstanceUnfreezeRecipeStepsPermissionsInfoIamPermissionsToProto converts a InstanceUnfreezeRecipeStepsPermissionsInfoIamPermissions resource to its proto representation. func Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoIamPermissionsToProto(o *alpha.InstanceUnfreezeRecipeStepsPermissionsInfoIamPermissions) *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoIamPermissions { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.ValueOrEmptyString(o.Permission), } return p } // InstanceUnfreezeRecipeStepsPermissionsInfoResourceToProto converts a InstanceUnfreezeRecipeStepsPermissionsInfoResource resource to its proto representation. func Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoResourceToProto(o *alpha.InstanceUnfreezeRecipeStepsPermissionsInfoResource) *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoResource { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsPermissionsInfoResource{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), Service: dcl.ValueOrEmptyString(o.Service), } p.Labels = make(map[string]string) for k, r := range o.Labels { p.Labels[k] = r } return p } // InstanceUnfreezeRecipeStepsKeyNotificationsUpdateToProto converts a InstanceUnfreezeRecipeStepsKeyNotificationsUpdate resource to its proto representation. func Tier2AlphaInstanceUnfreezeRecipeStepsKeyNotificationsUpdateToProto(o *alpha.InstanceUnfreezeRecipeStepsKeyNotificationsUpdate) *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsKeyNotificationsUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: Tier2AlphaInstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o.KeyNotificationsInfo), } return p } // InstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto converts a InstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource to its proto representation. func Tier2AlphaInstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o *alpha.InstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.ValueOrEmptyInt64(o.DataVersion), Delegate: dcl.ValueOrEmptyString(o.Delegate), } for _, r := range o.KeyNotificationConfigs { p.KeyNotificationConfigs = append(p.KeyNotificationConfigs, Tier2AlphaInstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(&r)) } return p } // InstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto converts a InstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource to its proto representation. func Tier2AlphaInstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(o *alpha.InstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceUnfreezeRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.ValueOrEmptyString(o.KeyOrVersionName), Grant: dcl.ValueOrEmptyString(o.Grant), DelegatorGaiaId: dcl.ValueOrEmptyInt64(o.DelegatorGaiaId), } return p } // InstancePreprocessReportInstanceHealthRecipeToProto converts a InstancePreprocessReportInstanceHealthRecipe resource to its proto representation. func Tier2AlphaInstancePreprocessReportInstanceHealthRecipeToProto(o *alpha.InstancePreprocessReportInstanceHealthRecipe) *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipe { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipe{ HonorCancelRequest: dcl.ValueOrEmptyBool(o.HonorCancelRequest), IgnoreRecipeAfter: dcl.ValueOrEmptyInt64(o.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.ValueOrEmptyDouble(o.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.ValueOrEmptyBool(o.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.ValueOrEmptyString(o.ReadonlyRecipeStartTime), DelayToStoreResourcesInClhDbNanos: dcl.ValueOrEmptyInt64(o.DelayToStoreResourcesInClhDbNanos), } for _, r := range o.Steps { p.Steps = append(p.Steps, Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsToProto(&r)) } for _, r := range o.ResourceNamesStoredInClhWithDelay { p.ResourceNamesStoredInClhWithDelay = append(p.ResourceNamesStoredInClhWithDelay, r) } return p } // InstancePreprocessReportInstanceHealthRecipeStepsToProto converts a InstancePreprocessReportInstanceHealthRecipeSteps resource to its proto representation. func Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsToProto(o *alpha.InstancePreprocessReportInstanceHealthRecipeSteps) *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeSteps { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeSteps{ RelativeTime: dcl.ValueOrEmptyInt64(o.RelativeTime), SleepDuration: dcl.ValueOrEmptyInt64(o.SleepDuration), Action: Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsActionEnumToProto(o.Action), Status: Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsStatusToProto(o.Status), ErrorSpace: dcl.ValueOrEmptyString(o.ErrorSpace), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), ResourceMetadataSize: dcl.ValueOrEmptyInt64(o.ResourceMetadataSize), Description: dcl.ValueOrEmptyString(o.Description), UpdatedRepeatOperationDelaySec: dcl.ValueOrEmptyDouble(o.UpdatedRepeatOperationDelaySec), PreprocessUpdate: Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPreprocessUpdateToProto(o.PreprocessUpdate), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), RequestedTenantProject: Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProjectToProto(o.RequestedTenantProject), KeyNotificationsUpdate: Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateToProto(o.KeyNotificationsUpdate), ClhDataUpdateTime: dcl.ValueOrEmptyString(o.ClhDataUpdateTime), PublicErrorMessage: dcl.ValueOrEmptyString(o.PublicErrorMessage), } for _, r := range o.QuotaRequestDeltas { p.QuotaRequestDeltas = append(p.QuotaRequestDeltas, Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsQuotaRequestDeltasToProto(&r)) } for _, r := range o.PermissionsInfo { p.PermissionsInfo = append(p.PermissionsInfo, Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoToProto(&r)) } return p } // InstancePreprocessReportInstanceHealthRecipeStepsStatusToProto converts a InstancePreprocessReportInstanceHealthRecipeStepsStatus resource to its proto representation. func Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsStatusToProto(o *alpha.InstancePreprocessReportInstanceHealthRecipeStepsStatus) *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsStatus { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsStatus{ Code: dcl.ValueOrEmptyInt64(o.Code), Message: dcl.ValueOrEmptyString(o.Message), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsStatusDetailsToProto(&r)) } return p } // InstancePreprocessReportInstanceHealthRecipeStepsStatusDetailsToProto converts a InstancePreprocessReportInstanceHealthRecipeStepsStatusDetails resource to its proto representation. func Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsStatusDetailsToProto(o *alpha.InstancePreprocessReportInstanceHealthRecipeStepsStatusDetails) *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsStatusDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsStatusDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstancePreprocessReportInstanceHealthRecipeStepsQuotaRequestDeltasToProto converts a InstancePreprocessReportInstanceHealthRecipeStepsQuotaRequestDeltas resource to its proto representation. func Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsQuotaRequestDeltasToProto(o *alpha.InstancePreprocessReportInstanceHealthRecipeStepsQuotaRequestDeltas) *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsQuotaRequestDeltas { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsQuotaRequestDeltas{ MetricName: dcl.ValueOrEmptyString(o.MetricName), Amount: dcl.ValueOrEmptyInt64(o.Amount), QuotaLocationName: dcl.ValueOrEmptyString(o.QuotaLocationName), } return p } // InstancePreprocessReportInstanceHealthRecipeStepsPreprocessUpdateToProto converts a InstancePreprocessReportInstanceHealthRecipeStepsPreprocessUpdate resource to its proto representation. func Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPreprocessUpdateToProto(o *alpha.InstancePreprocessReportInstanceHealthRecipeStepsPreprocessUpdate) *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPreprocessUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.ValueOrEmptyString(o.LatencySloBucketName), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), } return p } // InstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProjectToProto converts a InstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProject resource to its proto representation. func Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProjectToProto(o *alpha.InstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProject) *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProject { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProject{ Tag: dcl.ValueOrEmptyString(o.Tag), Folder: dcl.ValueOrEmptyString(o.Folder), Scope: Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnumToProto(o.Scope), } return p } // InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoToProto converts a InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfo resource to its proto representation. func Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoToProto(o *alpha.InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfo) *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfo{ PolicyName: Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameToProto(o.PolicyName), ResourcePath: dcl.ValueOrEmptyString(o.ResourcePath), ApiAttrs: Tier2AlphaInstanceGoogleprotobufstructToProto(o.ApiAttrs), PolicyNameMode: Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(o.PolicyNameMode), Resource: Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoResourceToProto(o.Resource), } for _, r := range o.IamPermissions { p.IamPermissions = append(p.IamPermissions, Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoIamPermissionsToProto(&r)) } return p } // InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameToProto converts a InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyName resource to its proto representation. func Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameToProto(o *alpha.InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyName) *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyName { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoPolicyName{ Type: dcl.ValueOrEmptyString(o.Type), Id: dcl.ValueOrEmptyString(o.Id), Region: dcl.ValueOrEmptyString(o.Region), } return p } // InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoIamPermissionsToProto converts a InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoIamPermissions resource to its proto representation. func Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoIamPermissionsToProto(o *alpha.InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoIamPermissions) *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoIamPermissions { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.ValueOrEmptyString(o.Permission), } return p } // InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoResourceToProto converts a InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoResource resource to its proto representation. func Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoResourceToProto(o *alpha.InstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoResource) *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoResource { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsPermissionsInfoResource{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), Service: dcl.ValueOrEmptyString(o.Service), } p.Labels = make(map[string]string) for k, r := range o.Labels { p.Labels[k] = r } return p } // InstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateToProto converts a InstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdate resource to its proto representation. func Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateToProto(o *alpha.InstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdate) *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o.KeyNotificationsInfo), } return p } // InstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto converts a InstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource to its proto representation. func Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o *alpha.InstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.ValueOrEmptyInt64(o.DataVersion), Delegate: dcl.ValueOrEmptyString(o.Delegate), } for _, r := range o.KeyNotificationConfigs { p.KeyNotificationConfigs = append(p.KeyNotificationConfigs, Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(&r)) } return p } // InstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto converts a InstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource to its proto representation. func Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(o *alpha.InstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.ValueOrEmptyString(o.KeyOrVersionName), Grant: dcl.ValueOrEmptyString(o.Grant), DelegatorGaiaId: dcl.ValueOrEmptyInt64(o.DelegatorGaiaId), } return p } // InstanceReportInstanceHealthRecipeToProto converts a InstanceReportInstanceHealthRecipe resource to its proto representation. func Tier2AlphaInstanceReportInstanceHealthRecipeToProto(o *alpha.InstanceReportInstanceHealthRecipe) *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipe { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReportInstanceHealthRecipe{ HonorCancelRequest: dcl.ValueOrEmptyBool(o.HonorCancelRequest), IgnoreRecipeAfter: dcl.ValueOrEmptyInt64(o.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.ValueOrEmptyDouble(o.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.ValueOrEmptyBool(o.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.ValueOrEmptyString(o.ReadonlyRecipeStartTime), DelayToStoreResourcesInClhDbNanos: dcl.ValueOrEmptyInt64(o.DelayToStoreResourcesInClhDbNanos), } for _, r := range o.Steps { p.Steps = append(p.Steps, Tier2AlphaInstanceReportInstanceHealthRecipeStepsToProto(&r)) } for _, r := range o.ResourceNamesStoredInClhWithDelay { p.ResourceNamesStoredInClhWithDelay = append(p.ResourceNamesStoredInClhWithDelay, r) } return p } // InstanceReportInstanceHealthRecipeStepsToProto converts a InstanceReportInstanceHealthRecipeSteps resource to its proto representation. func Tier2AlphaInstanceReportInstanceHealthRecipeStepsToProto(o *alpha.InstanceReportInstanceHealthRecipeSteps) *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeSteps { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeSteps{ RelativeTime: dcl.ValueOrEmptyInt64(o.RelativeTime), SleepDuration: dcl.ValueOrEmptyInt64(o.SleepDuration), Action: Tier2AlphaInstanceReportInstanceHealthRecipeStepsActionEnumToProto(o.Action), Status: Tier2AlphaInstanceReportInstanceHealthRecipeStepsStatusToProto(o.Status), ErrorSpace: dcl.ValueOrEmptyString(o.ErrorSpace), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), ResourceMetadataSize: dcl.ValueOrEmptyInt64(o.ResourceMetadataSize), Description: dcl.ValueOrEmptyString(o.Description), UpdatedRepeatOperationDelaySec: dcl.ValueOrEmptyDouble(o.UpdatedRepeatOperationDelaySec), PreprocessUpdate: Tier2AlphaInstanceReportInstanceHealthRecipeStepsPreprocessUpdateToProto(o.PreprocessUpdate), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), RequestedTenantProject: Tier2AlphaInstanceReportInstanceHealthRecipeStepsRequestedTenantProjectToProto(o.RequestedTenantProject), KeyNotificationsUpdate: Tier2AlphaInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateToProto(o.KeyNotificationsUpdate), ClhDataUpdateTime: dcl.ValueOrEmptyString(o.ClhDataUpdateTime), PublicErrorMessage: dcl.ValueOrEmptyString(o.PublicErrorMessage), } for _, r := range o.QuotaRequestDeltas { p.QuotaRequestDeltas = append(p.QuotaRequestDeltas, Tier2AlphaInstanceReportInstanceHealthRecipeStepsQuotaRequestDeltasToProto(&r)) } for _, r := range o.PermissionsInfo { p.PermissionsInfo = append(p.PermissionsInfo, Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoToProto(&r)) } return p } // InstanceReportInstanceHealthRecipeStepsStatusToProto converts a InstanceReportInstanceHealthRecipeStepsStatus resource to its proto representation. func Tier2AlphaInstanceReportInstanceHealthRecipeStepsStatusToProto(o *alpha.InstanceReportInstanceHealthRecipeStepsStatus) *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsStatus { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsStatus{ Code: dcl.ValueOrEmptyInt64(o.Code), Message: dcl.ValueOrEmptyString(o.Message), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstanceReportInstanceHealthRecipeStepsStatusDetailsToProto(&r)) } return p } // InstanceReportInstanceHealthRecipeStepsStatusDetailsToProto converts a InstanceReportInstanceHealthRecipeStepsStatusDetails resource to its proto representation. func Tier2AlphaInstanceReportInstanceHealthRecipeStepsStatusDetailsToProto(o *alpha.InstanceReportInstanceHealthRecipeStepsStatusDetails) *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsStatusDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsStatusDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstanceReportInstanceHealthRecipeStepsQuotaRequestDeltasToProto converts a InstanceReportInstanceHealthRecipeStepsQuotaRequestDeltas resource to its proto representation. func Tier2AlphaInstanceReportInstanceHealthRecipeStepsQuotaRequestDeltasToProto(o *alpha.InstanceReportInstanceHealthRecipeStepsQuotaRequestDeltas) *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsQuotaRequestDeltas { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsQuotaRequestDeltas{ MetricName: dcl.ValueOrEmptyString(o.MetricName), Amount: dcl.ValueOrEmptyInt64(o.Amount), QuotaLocationName: dcl.ValueOrEmptyString(o.QuotaLocationName), } return p } // InstanceReportInstanceHealthRecipeStepsPreprocessUpdateToProto converts a InstanceReportInstanceHealthRecipeStepsPreprocessUpdate resource to its proto representation. func Tier2AlphaInstanceReportInstanceHealthRecipeStepsPreprocessUpdateToProto(o *alpha.InstanceReportInstanceHealthRecipeStepsPreprocessUpdate) *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsPreprocessUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.ValueOrEmptyString(o.LatencySloBucketName), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), } return p } // InstanceReportInstanceHealthRecipeStepsRequestedTenantProjectToProto converts a InstanceReportInstanceHealthRecipeStepsRequestedTenantProject resource to its proto representation. func Tier2AlphaInstanceReportInstanceHealthRecipeStepsRequestedTenantProjectToProto(o *alpha.InstanceReportInstanceHealthRecipeStepsRequestedTenantProject) *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsRequestedTenantProject { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsRequestedTenantProject{ Tag: dcl.ValueOrEmptyString(o.Tag), Folder: dcl.ValueOrEmptyString(o.Folder), Scope: Tier2AlphaInstanceReportInstanceHealthRecipeStepsRequestedTenantProjectScopeEnumToProto(o.Scope), } return p } // InstanceReportInstanceHealthRecipeStepsPermissionsInfoToProto converts a InstanceReportInstanceHealthRecipeStepsPermissionsInfo resource to its proto representation. func Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoToProto(o *alpha.InstanceReportInstanceHealthRecipeStepsPermissionsInfo) *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfo{ PolicyName: Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameToProto(o.PolicyName), ResourcePath: dcl.ValueOrEmptyString(o.ResourcePath), ApiAttrs: Tier2AlphaInstanceGoogleprotobufstructToProto(o.ApiAttrs), PolicyNameMode: Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(o.PolicyNameMode), Resource: Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoResourceToProto(o.Resource), } for _, r := range o.IamPermissions { p.IamPermissions = append(p.IamPermissions, Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoIamPermissionsToProto(&r)) } return p } // InstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameToProto converts a InstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyName resource to its proto representation. func Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyNameToProto(o *alpha.InstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyName) *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyName { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoPolicyName{ Type: dcl.ValueOrEmptyString(o.Type), Id: dcl.ValueOrEmptyString(o.Id), Region: dcl.ValueOrEmptyString(o.Region), } return p } // InstanceReportInstanceHealthRecipeStepsPermissionsInfoIamPermissionsToProto converts a InstanceReportInstanceHealthRecipeStepsPermissionsInfoIamPermissions resource to its proto representation. func Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoIamPermissionsToProto(o *alpha.InstanceReportInstanceHealthRecipeStepsPermissionsInfoIamPermissions) *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoIamPermissions { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.ValueOrEmptyString(o.Permission), } return p } // InstanceReportInstanceHealthRecipeStepsPermissionsInfoResourceToProto converts a InstanceReportInstanceHealthRecipeStepsPermissionsInfoResource resource to its proto representation. func Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoResourceToProto(o *alpha.InstanceReportInstanceHealthRecipeStepsPermissionsInfoResource) *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoResource { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsPermissionsInfoResource{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), Service: dcl.ValueOrEmptyString(o.Service), } p.Labels = make(map[string]string) for k, r := range o.Labels { p.Labels[k] = r } return p } // InstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateToProto converts a InstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdate resource to its proto representation. func Tier2AlphaInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateToProto(o *alpha.InstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdate) *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: Tier2AlphaInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o.KeyNotificationsInfo), } return p } // InstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto converts a InstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource to its proto representation. func Tier2AlphaInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o *alpha.InstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.ValueOrEmptyInt64(o.DataVersion), Delegate: dcl.ValueOrEmptyString(o.Delegate), } for _, r := range o.KeyNotificationConfigs { p.KeyNotificationConfigs = append(p.KeyNotificationConfigs, Tier2AlphaInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(&r)) } return p } // InstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto converts a InstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource to its proto representation. func Tier2AlphaInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(o *alpha.InstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReportInstanceHealthRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.ValueOrEmptyString(o.KeyOrVersionName), Grant: dcl.ValueOrEmptyString(o.Grant), DelegatorGaiaId: dcl.ValueOrEmptyInt64(o.DelegatorGaiaId), } return p } // InstancePreprocessGetRecipeToProto converts a InstancePreprocessGetRecipe resource to its proto representation. func Tier2AlphaInstancePreprocessGetRecipeToProto(o *alpha.InstancePreprocessGetRecipe) *alphapb.Tier2AlphaInstancePreprocessGetRecipe { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessGetRecipe{ HonorCancelRequest: dcl.ValueOrEmptyBool(o.HonorCancelRequest), IgnoreRecipeAfter: dcl.ValueOrEmptyInt64(o.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.ValueOrEmptyDouble(o.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.ValueOrEmptyBool(o.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.ValueOrEmptyString(o.ReadonlyRecipeStartTime), DelayToStoreResourcesInClhDbNanos: dcl.ValueOrEmptyInt64(o.DelayToStoreResourcesInClhDbNanos), } for _, r := range o.Steps { p.Steps = append(p.Steps, Tier2AlphaInstancePreprocessGetRecipeStepsToProto(&r)) } for _, r := range o.ResourceNamesStoredInClhWithDelay { p.ResourceNamesStoredInClhWithDelay = append(p.ResourceNamesStoredInClhWithDelay, r) } return p } // InstancePreprocessGetRecipeStepsToProto converts a InstancePreprocessGetRecipeSteps resource to its proto representation. func Tier2AlphaInstancePreprocessGetRecipeStepsToProto(o *alpha.InstancePreprocessGetRecipeSteps) *alphapb.Tier2AlphaInstancePreprocessGetRecipeSteps { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessGetRecipeSteps{ RelativeTime: dcl.ValueOrEmptyInt64(o.RelativeTime), SleepDuration: dcl.ValueOrEmptyInt64(o.SleepDuration), Action: Tier2AlphaInstancePreprocessGetRecipeStepsActionEnumToProto(o.Action), Status: Tier2AlphaInstancePreprocessGetRecipeStepsStatusToProto(o.Status), ErrorSpace: dcl.ValueOrEmptyString(o.ErrorSpace), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), ResourceMetadataSize: dcl.ValueOrEmptyInt64(o.ResourceMetadataSize), Description: dcl.ValueOrEmptyString(o.Description), UpdatedRepeatOperationDelaySec: dcl.ValueOrEmptyDouble(o.UpdatedRepeatOperationDelaySec), PreprocessUpdate: Tier2AlphaInstancePreprocessGetRecipeStepsPreprocessUpdateToProto(o.PreprocessUpdate), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), RequestedTenantProject: Tier2AlphaInstancePreprocessGetRecipeStepsRequestedTenantProjectToProto(o.RequestedTenantProject), KeyNotificationsUpdate: Tier2AlphaInstancePreprocessGetRecipeStepsKeyNotificationsUpdateToProto(o.KeyNotificationsUpdate), ClhDataUpdateTime: dcl.ValueOrEmptyString(o.ClhDataUpdateTime), PublicErrorMessage: dcl.ValueOrEmptyString(o.PublicErrorMessage), } for _, r := range o.QuotaRequestDeltas { p.QuotaRequestDeltas = append(p.QuotaRequestDeltas, Tier2AlphaInstancePreprocessGetRecipeStepsQuotaRequestDeltasToProto(&r)) } for _, r := range o.PermissionsInfo { p.PermissionsInfo = append(p.PermissionsInfo, Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoToProto(&r)) } return p } // InstancePreprocessGetRecipeStepsStatusToProto converts a InstancePreprocessGetRecipeStepsStatus resource to its proto representation. func Tier2AlphaInstancePreprocessGetRecipeStepsStatusToProto(o *alpha.InstancePreprocessGetRecipeStepsStatus) *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsStatus { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsStatus{ Code: dcl.ValueOrEmptyInt64(o.Code), Message: dcl.ValueOrEmptyString(o.Message), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstancePreprocessGetRecipeStepsStatusDetailsToProto(&r)) } return p } // InstancePreprocessGetRecipeStepsStatusDetailsToProto converts a InstancePreprocessGetRecipeStepsStatusDetails resource to its proto representation. func Tier2AlphaInstancePreprocessGetRecipeStepsStatusDetailsToProto(o *alpha.InstancePreprocessGetRecipeStepsStatusDetails) *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsStatusDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsStatusDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstancePreprocessGetRecipeStepsQuotaRequestDeltasToProto converts a InstancePreprocessGetRecipeStepsQuotaRequestDeltas resource to its proto representation. func Tier2AlphaInstancePreprocessGetRecipeStepsQuotaRequestDeltasToProto(o *alpha.InstancePreprocessGetRecipeStepsQuotaRequestDeltas) *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsQuotaRequestDeltas { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsQuotaRequestDeltas{ MetricName: dcl.ValueOrEmptyString(o.MetricName), Amount: dcl.ValueOrEmptyInt64(o.Amount), QuotaLocationName: dcl.ValueOrEmptyString(o.QuotaLocationName), } return p } // InstancePreprocessGetRecipeStepsPreprocessUpdateToProto converts a InstancePreprocessGetRecipeStepsPreprocessUpdate resource to its proto representation. func Tier2AlphaInstancePreprocessGetRecipeStepsPreprocessUpdateToProto(o *alpha.InstancePreprocessGetRecipeStepsPreprocessUpdate) *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsPreprocessUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.ValueOrEmptyString(o.LatencySloBucketName), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), } return p } // InstancePreprocessGetRecipeStepsRequestedTenantProjectToProto converts a InstancePreprocessGetRecipeStepsRequestedTenantProject resource to its proto representation. func Tier2AlphaInstancePreprocessGetRecipeStepsRequestedTenantProjectToProto(o *alpha.InstancePreprocessGetRecipeStepsRequestedTenantProject) *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsRequestedTenantProject { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsRequestedTenantProject{ Tag: dcl.ValueOrEmptyString(o.Tag), Folder: dcl.ValueOrEmptyString(o.Folder), Scope: Tier2AlphaInstancePreprocessGetRecipeStepsRequestedTenantProjectScopeEnumToProto(o.Scope), } return p } // InstancePreprocessGetRecipeStepsPermissionsInfoToProto converts a InstancePreprocessGetRecipeStepsPermissionsInfo resource to its proto representation. func Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoToProto(o *alpha.InstancePreprocessGetRecipeStepsPermissionsInfo) *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfo{ PolicyName: Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoPolicyNameToProto(o.PolicyName), ResourcePath: dcl.ValueOrEmptyString(o.ResourcePath), ApiAttrs: Tier2AlphaInstanceGoogleprotobufstructToProto(o.ApiAttrs), PolicyNameMode: Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(o.PolicyNameMode), Resource: Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoResourceToProto(o.Resource), } for _, r := range o.IamPermissions { p.IamPermissions = append(p.IamPermissions, Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoIamPermissionsToProto(&r)) } return p } // InstancePreprocessGetRecipeStepsPermissionsInfoPolicyNameToProto converts a InstancePreprocessGetRecipeStepsPermissionsInfoPolicyName resource to its proto representation. func Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoPolicyNameToProto(o *alpha.InstancePreprocessGetRecipeStepsPermissionsInfoPolicyName) *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoPolicyName { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoPolicyName{ Type: dcl.ValueOrEmptyString(o.Type), Id: dcl.ValueOrEmptyString(o.Id), Region: dcl.ValueOrEmptyString(o.Region), } return p } // InstancePreprocessGetRecipeStepsPermissionsInfoIamPermissionsToProto converts a InstancePreprocessGetRecipeStepsPermissionsInfoIamPermissions resource to its proto representation. func Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoIamPermissionsToProto(o *alpha.InstancePreprocessGetRecipeStepsPermissionsInfoIamPermissions) *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoIamPermissions { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.ValueOrEmptyString(o.Permission), } return p } // InstancePreprocessGetRecipeStepsPermissionsInfoResourceToProto converts a InstancePreprocessGetRecipeStepsPermissionsInfoResource resource to its proto representation. func Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoResourceToProto(o *alpha.InstancePreprocessGetRecipeStepsPermissionsInfoResource) *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoResource { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsPermissionsInfoResource{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), Service: dcl.ValueOrEmptyString(o.Service), } p.Labels = make(map[string]string) for k, r := range o.Labels { p.Labels[k] = r } return p } // InstancePreprocessGetRecipeStepsKeyNotificationsUpdateToProto converts a InstancePreprocessGetRecipeStepsKeyNotificationsUpdate resource to its proto representation. func Tier2AlphaInstancePreprocessGetRecipeStepsKeyNotificationsUpdateToProto(o *alpha.InstancePreprocessGetRecipeStepsKeyNotificationsUpdate) *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsKeyNotificationsUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: Tier2AlphaInstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o.KeyNotificationsInfo), } return p } // InstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto converts a InstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource to its proto representation. func Tier2AlphaInstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o *alpha.InstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.ValueOrEmptyInt64(o.DataVersion), Delegate: dcl.ValueOrEmptyString(o.Delegate), } for _, r := range o.KeyNotificationConfigs { p.KeyNotificationConfigs = append(p.KeyNotificationConfigs, Tier2AlphaInstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(&r)) } return p } // InstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto converts a InstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource to its proto representation. func Tier2AlphaInstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(o *alpha.InstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessGetRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.ValueOrEmptyString(o.KeyOrVersionName), Grant: dcl.ValueOrEmptyString(o.Grant), DelegatorGaiaId: dcl.ValueOrEmptyInt64(o.DelegatorGaiaId), } return p } // InstanceNotifyKeyAvailableRecipeToProto converts a InstanceNotifyKeyAvailableRecipe resource to its proto representation. func Tier2AlphaInstanceNotifyKeyAvailableRecipeToProto(o *alpha.InstanceNotifyKeyAvailableRecipe) *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipe { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipe{ HonorCancelRequest: dcl.ValueOrEmptyBool(o.HonorCancelRequest), IgnoreRecipeAfter: dcl.ValueOrEmptyInt64(o.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.ValueOrEmptyDouble(o.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.ValueOrEmptyBool(o.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.ValueOrEmptyString(o.ReadonlyRecipeStartTime), DelayToStoreResourcesInClhDbNanos: dcl.ValueOrEmptyInt64(o.DelayToStoreResourcesInClhDbNanos), } for _, r := range o.Steps { p.Steps = append(p.Steps, Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsToProto(&r)) } for _, r := range o.ResourceNamesStoredInClhWithDelay { p.ResourceNamesStoredInClhWithDelay = append(p.ResourceNamesStoredInClhWithDelay, r) } return p } // InstanceNotifyKeyAvailableRecipeStepsToProto converts a InstanceNotifyKeyAvailableRecipeSteps resource to its proto representation. func Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsToProto(o *alpha.InstanceNotifyKeyAvailableRecipeSteps) *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeSteps { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeSteps{ RelativeTime: dcl.ValueOrEmptyInt64(o.RelativeTime), SleepDuration: dcl.ValueOrEmptyInt64(o.SleepDuration), Action: Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsActionEnumToProto(o.Action), Status: Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsStatusToProto(o.Status), ErrorSpace: dcl.ValueOrEmptyString(o.ErrorSpace), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), ResourceMetadataSize: dcl.ValueOrEmptyInt64(o.ResourceMetadataSize), Description: dcl.ValueOrEmptyString(o.Description), UpdatedRepeatOperationDelaySec: dcl.ValueOrEmptyDouble(o.UpdatedRepeatOperationDelaySec), PreprocessUpdate: Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPreprocessUpdateToProto(o.PreprocessUpdate), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), RequestedTenantProject: Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsRequestedTenantProjectToProto(o.RequestedTenantProject), KeyNotificationsUpdate: Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateToProto(o.KeyNotificationsUpdate), ClhDataUpdateTime: dcl.ValueOrEmptyString(o.ClhDataUpdateTime), PublicErrorMessage: dcl.ValueOrEmptyString(o.PublicErrorMessage), } for _, r := range o.QuotaRequestDeltas { p.QuotaRequestDeltas = append(p.QuotaRequestDeltas, Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsQuotaRequestDeltasToProto(&r)) } for _, r := range o.PermissionsInfo { p.PermissionsInfo = append(p.PermissionsInfo, Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoToProto(&r)) } return p } // InstanceNotifyKeyAvailableRecipeStepsStatusToProto converts a InstanceNotifyKeyAvailableRecipeStepsStatus resource to its proto representation. func Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsStatusToProto(o *alpha.InstanceNotifyKeyAvailableRecipeStepsStatus) *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsStatus { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsStatus{ Code: dcl.ValueOrEmptyInt64(o.Code), Message: dcl.ValueOrEmptyString(o.Message), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsStatusDetailsToProto(&r)) } return p } // InstanceNotifyKeyAvailableRecipeStepsStatusDetailsToProto converts a InstanceNotifyKeyAvailableRecipeStepsStatusDetails resource to its proto representation. func Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsStatusDetailsToProto(o *alpha.InstanceNotifyKeyAvailableRecipeStepsStatusDetails) *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsStatusDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsStatusDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstanceNotifyKeyAvailableRecipeStepsQuotaRequestDeltasToProto converts a InstanceNotifyKeyAvailableRecipeStepsQuotaRequestDeltas resource to its proto representation. func Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsQuotaRequestDeltasToProto(o *alpha.InstanceNotifyKeyAvailableRecipeStepsQuotaRequestDeltas) *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsQuotaRequestDeltas { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsQuotaRequestDeltas{ MetricName: dcl.ValueOrEmptyString(o.MetricName), Amount: dcl.ValueOrEmptyInt64(o.Amount), QuotaLocationName: dcl.ValueOrEmptyString(o.QuotaLocationName), } return p } // InstanceNotifyKeyAvailableRecipeStepsPreprocessUpdateToProto converts a InstanceNotifyKeyAvailableRecipeStepsPreprocessUpdate resource to its proto representation. func Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPreprocessUpdateToProto(o *alpha.InstanceNotifyKeyAvailableRecipeStepsPreprocessUpdate) *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPreprocessUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.ValueOrEmptyString(o.LatencySloBucketName), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), } return p } // InstanceNotifyKeyAvailableRecipeStepsRequestedTenantProjectToProto converts a InstanceNotifyKeyAvailableRecipeStepsRequestedTenantProject resource to its proto representation. func Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsRequestedTenantProjectToProto(o *alpha.InstanceNotifyKeyAvailableRecipeStepsRequestedTenantProject) *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsRequestedTenantProject { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsRequestedTenantProject{ Tag: dcl.ValueOrEmptyString(o.Tag), Folder: dcl.ValueOrEmptyString(o.Folder), Scope: Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsRequestedTenantProjectScopeEnumToProto(o.Scope), } return p } // InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoToProto converts a InstanceNotifyKeyAvailableRecipeStepsPermissionsInfo resource to its proto representation. func Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoToProto(o *alpha.InstanceNotifyKeyAvailableRecipeStepsPermissionsInfo) *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfo{ PolicyName: Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyNameToProto(o.PolicyName), ResourcePath: dcl.ValueOrEmptyString(o.ResourcePath), ApiAttrs: Tier2AlphaInstanceGoogleprotobufstructToProto(o.ApiAttrs), PolicyNameMode: Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(o.PolicyNameMode), Resource: Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoResourceToProto(o.Resource), } for _, r := range o.IamPermissions { p.IamPermissions = append(p.IamPermissions, Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoIamPermissionsToProto(&r)) } return p } // InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyNameToProto converts a InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyName resource to its proto representation. func Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyNameToProto(o *alpha.InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyName) *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyName { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoPolicyName{ Type: dcl.ValueOrEmptyString(o.Type), Id: dcl.ValueOrEmptyString(o.Id), Region: dcl.ValueOrEmptyString(o.Region), } return p } // InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoIamPermissionsToProto converts a InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoIamPermissions resource to its proto representation. func Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoIamPermissionsToProto(o *alpha.InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoIamPermissions) *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoIamPermissions { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.ValueOrEmptyString(o.Permission), } return p } // InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoResourceToProto converts a InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoResource resource to its proto representation. func Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoResourceToProto(o *alpha.InstanceNotifyKeyAvailableRecipeStepsPermissionsInfoResource) *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoResource { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsPermissionsInfoResource{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), Service: dcl.ValueOrEmptyString(o.Service), } p.Labels = make(map[string]string) for k, r := range o.Labels { p.Labels[k] = r } return p } // InstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateToProto converts a InstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdate resource to its proto representation. func Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateToProto(o *alpha.InstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdate) *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o.KeyNotificationsInfo), } return p } // InstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto converts a InstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource to its proto representation. func Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o *alpha.InstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.ValueOrEmptyInt64(o.DataVersion), Delegate: dcl.ValueOrEmptyString(o.Delegate), } for _, r := range o.KeyNotificationConfigs { p.KeyNotificationConfigs = append(p.KeyNotificationConfigs, Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(&r)) } return p } // InstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto converts a InstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource to its proto representation. func Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(o *alpha.InstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyAvailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.ValueOrEmptyString(o.KeyOrVersionName), Grant: dcl.ValueOrEmptyString(o.Grant), DelegatorGaiaId: dcl.ValueOrEmptyInt64(o.DelegatorGaiaId), } return p } // InstanceNotifyKeyUnavailableRecipeToProto converts a InstanceNotifyKeyUnavailableRecipe resource to its proto representation. func Tier2AlphaInstanceNotifyKeyUnavailableRecipeToProto(o *alpha.InstanceNotifyKeyUnavailableRecipe) *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipe { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipe{ HonorCancelRequest: dcl.ValueOrEmptyBool(o.HonorCancelRequest), IgnoreRecipeAfter: dcl.ValueOrEmptyInt64(o.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.ValueOrEmptyDouble(o.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.ValueOrEmptyBool(o.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.ValueOrEmptyString(o.ReadonlyRecipeStartTime), DelayToStoreResourcesInClhDbNanos: dcl.ValueOrEmptyInt64(o.DelayToStoreResourcesInClhDbNanos), } for _, r := range o.Steps { p.Steps = append(p.Steps, Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsToProto(&r)) } for _, r := range o.ResourceNamesStoredInClhWithDelay { p.ResourceNamesStoredInClhWithDelay = append(p.ResourceNamesStoredInClhWithDelay, r) } return p } // InstanceNotifyKeyUnavailableRecipeStepsToProto converts a InstanceNotifyKeyUnavailableRecipeSteps resource to its proto representation. func Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsToProto(o *alpha.InstanceNotifyKeyUnavailableRecipeSteps) *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeSteps { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeSteps{ RelativeTime: dcl.ValueOrEmptyInt64(o.RelativeTime), SleepDuration: dcl.ValueOrEmptyInt64(o.SleepDuration), Action: Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsActionEnumToProto(o.Action), Status: Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsStatusToProto(o.Status), ErrorSpace: dcl.ValueOrEmptyString(o.ErrorSpace), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), ResourceMetadataSize: dcl.ValueOrEmptyInt64(o.ResourceMetadataSize), Description: dcl.ValueOrEmptyString(o.Description), UpdatedRepeatOperationDelaySec: dcl.ValueOrEmptyDouble(o.UpdatedRepeatOperationDelaySec), PreprocessUpdate: Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPreprocessUpdateToProto(o.PreprocessUpdate), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), RequestedTenantProject: Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProjectToProto(o.RequestedTenantProject), KeyNotificationsUpdate: Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateToProto(o.KeyNotificationsUpdate), ClhDataUpdateTime: dcl.ValueOrEmptyString(o.ClhDataUpdateTime), PublicErrorMessage: dcl.ValueOrEmptyString(o.PublicErrorMessage), } for _, r := range o.QuotaRequestDeltas { p.QuotaRequestDeltas = append(p.QuotaRequestDeltas, Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsQuotaRequestDeltasToProto(&r)) } for _, r := range o.PermissionsInfo { p.PermissionsInfo = append(p.PermissionsInfo, Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoToProto(&r)) } return p } // InstanceNotifyKeyUnavailableRecipeStepsStatusToProto converts a InstanceNotifyKeyUnavailableRecipeStepsStatus resource to its proto representation. func Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsStatusToProto(o *alpha.InstanceNotifyKeyUnavailableRecipeStepsStatus) *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsStatus { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsStatus{ Code: dcl.ValueOrEmptyInt64(o.Code), Message: dcl.ValueOrEmptyString(o.Message), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsStatusDetailsToProto(&r)) } return p } // InstanceNotifyKeyUnavailableRecipeStepsStatusDetailsToProto converts a InstanceNotifyKeyUnavailableRecipeStepsStatusDetails resource to its proto representation. func Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsStatusDetailsToProto(o *alpha.InstanceNotifyKeyUnavailableRecipeStepsStatusDetails) *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsStatusDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsStatusDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstanceNotifyKeyUnavailableRecipeStepsQuotaRequestDeltasToProto converts a InstanceNotifyKeyUnavailableRecipeStepsQuotaRequestDeltas resource to its proto representation. func Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsQuotaRequestDeltasToProto(o *alpha.InstanceNotifyKeyUnavailableRecipeStepsQuotaRequestDeltas) *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsQuotaRequestDeltas { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsQuotaRequestDeltas{ MetricName: dcl.ValueOrEmptyString(o.MetricName), Amount: dcl.ValueOrEmptyInt64(o.Amount), QuotaLocationName: dcl.ValueOrEmptyString(o.QuotaLocationName), } return p } // InstanceNotifyKeyUnavailableRecipeStepsPreprocessUpdateToProto converts a InstanceNotifyKeyUnavailableRecipeStepsPreprocessUpdate resource to its proto representation. func Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPreprocessUpdateToProto(o *alpha.InstanceNotifyKeyUnavailableRecipeStepsPreprocessUpdate) *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPreprocessUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.ValueOrEmptyString(o.LatencySloBucketName), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), } return p } // InstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProjectToProto converts a InstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProject resource to its proto representation. func Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProjectToProto(o *alpha.InstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProject) *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProject { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProject{ Tag: dcl.ValueOrEmptyString(o.Tag), Folder: dcl.ValueOrEmptyString(o.Folder), Scope: Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsRequestedTenantProjectScopeEnumToProto(o.Scope), } return p } // InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoToProto converts a InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfo resource to its proto representation. func Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoToProto(o *alpha.InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfo) *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfo{ PolicyName: Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyNameToProto(o.PolicyName), ResourcePath: dcl.ValueOrEmptyString(o.ResourcePath), ApiAttrs: Tier2AlphaInstanceGoogleprotobufstructToProto(o.ApiAttrs), PolicyNameMode: Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(o.PolicyNameMode), Resource: Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoResourceToProto(o.Resource), } for _, r := range o.IamPermissions { p.IamPermissions = append(p.IamPermissions, Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoIamPermissionsToProto(&r)) } return p } // InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyNameToProto converts a InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyName resource to its proto representation. func Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyNameToProto(o *alpha.InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyName) *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyName { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoPolicyName{ Type: dcl.ValueOrEmptyString(o.Type), Id: dcl.ValueOrEmptyString(o.Id), Region: dcl.ValueOrEmptyString(o.Region), } return p } // InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoIamPermissionsToProto converts a InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoIamPermissions resource to its proto representation. func Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoIamPermissionsToProto(o *alpha.InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoIamPermissions) *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoIamPermissions { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.ValueOrEmptyString(o.Permission), } return p } // InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoResourceToProto converts a InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoResource resource to its proto representation. func Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoResourceToProto(o *alpha.InstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoResource) *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoResource { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsPermissionsInfoResource{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), Service: dcl.ValueOrEmptyString(o.Service), } p.Labels = make(map[string]string) for k, r := range o.Labels { p.Labels[k] = r } return p } // InstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateToProto converts a InstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdate resource to its proto representation. func Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateToProto(o *alpha.InstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdate) *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o.KeyNotificationsInfo), } return p } // InstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto converts a InstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource to its proto representation. func Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o *alpha.InstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.ValueOrEmptyInt64(o.DataVersion), Delegate: dcl.ValueOrEmptyString(o.Delegate), } for _, r := range o.KeyNotificationConfigs { p.KeyNotificationConfigs = append(p.KeyNotificationConfigs, Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(&r)) } return p } // InstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto converts a InstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource to its proto representation. func Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(o *alpha.InstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceNotifyKeyUnavailableRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.ValueOrEmptyString(o.KeyOrVersionName), Grant: dcl.ValueOrEmptyString(o.Grant), DelegatorGaiaId: dcl.ValueOrEmptyInt64(o.DelegatorGaiaId), } return p } // InstanceReadonlyRecipeToProto converts a InstanceReadonlyRecipe resource to its proto representation. func Tier2AlphaInstanceReadonlyRecipeToProto(o *alpha.InstanceReadonlyRecipe) *alphapb.Tier2AlphaInstanceReadonlyRecipe { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReadonlyRecipe{ HonorCancelRequest: dcl.ValueOrEmptyBool(o.HonorCancelRequest), IgnoreRecipeAfter: dcl.ValueOrEmptyInt64(o.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.ValueOrEmptyDouble(o.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.ValueOrEmptyBool(o.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.ValueOrEmptyString(o.ReadonlyRecipeStartTime), DelayToStoreResourcesInClhDbNanos: dcl.ValueOrEmptyInt64(o.DelayToStoreResourcesInClhDbNanos), } for _, r := range o.Steps { p.Steps = append(p.Steps, Tier2AlphaInstanceReadonlyRecipeStepsToProto(&r)) } for _, r := range o.ResourceNamesStoredInClhWithDelay { p.ResourceNamesStoredInClhWithDelay = append(p.ResourceNamesStoredInClhWithDelay, r) } return p } // InstanceReadonlyRecipeStepsToProto converts a InstanceReadonlyRecipeSteps resource to its proto representation. func Tier2AlphaInstanceReadonlyRecipeStepsToProto(o *alpha.InstanceReadonlyRecipeSteps) *alphapb.Tier2AlphaInstanceReadonlyRecipeSteps { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReadonlyRecipeSteps{ RelativeTime: dcl.ValueOrEmptyInt64(o.RelativeTime), SleepDuration: dcl.ValueOrEmptyInt64(o.SleepDuration), Action: Tier2AlphaInstanceReadonlyRecipeStepsActionEnumToProto(o.Action), Status: Tier2AlphaInstanceReadonlyRecipeStepsStatusToProto(o.Status), ErrorSpace: dcl.ValueOrEmptyString(o.ErrorSpace), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), ResourceMetadataSize: dcl.ValueOrEmptyInt64(o.ResourceMetadataSize), Description: dcl.ValueOrEmptyString(o.Description), UpdatedRepeatOperationDelaySec: dcl.ValueOrEmptyDouble(o.UpdatedRepeatOperationDelaySec), PreprocessUpdate: Tier2AlphaInstanceReadonlyRecipeStepsPreprocessUpdateToProto(o.PreprocessUpdate), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), RequestedTenantProject: Tier2AlphaInstanceReadonlyRecipeStepsRequestedTenantProjectToProto(o.RequestedTenantProject), KeyNotificationsUpdate: Tier2AlphaInstanceReadonlyRecipeStepsKeyNotificationsUpdateToProto(o.KeyNotificationsUpdate), ClhDataUpdateTime: dcl.ValueOrEmptyString(o.ClhDataUpdateTime), PublicErrorMessage: dcl.ValueOrEmptyString(o.PublicErrorMessage), } for _, r := range o.QuotaRequestDeltas { p.QuotaRequestDeltas = append(p.QuotaRequestDeltas, Tier2AlphaInstanceReadonlyRecipeStepsQuotaRequestDeltasToProto(&r)) } for _, r := range o.PermissionsInfo { p.PermissionsInfo = append(p.PermissionsInfo, Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoToProto(&r)) } return p } // InstanceReadonlyRecipeStepsStatusToProto converts a InstanceReadonlyRecipeStepsStatus resource to its proto representation. func Tier2AlphaInstanceReadonlyRecipeStepsStatusToProto(o *alpha.InstanceReadonlyRecipeStepsStatus) *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsStatus { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReadonlyRecipeStepsStatus{ Code: dcl.ValueOrEmptyInt64(o.Code), Message: dcl.ValueOrEmptyString(o.Message), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstanceReadonlyRecipeStepsStatusDetailsToProto(&r)) } return p } // InstanceReadonlyRecipeStepsStatusDetailsToProto converts a InstanceReadonlyRecipeStepsStatusDetails resource to its proto representation. func Tier2AlphaInstanceReadonlyRecipeStepsStatusDetailsToProto(o *alpha.InstanceReadonlyRecipeStepsStatusDetails) *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsStatusDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReadonlyRecipeStepsStatusDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstanceReadonlyRecipeStepsQuotaRequestDeltasToProto converts a InstanceReadonlyRecipeStepsQuotaRequestDeltas resource to its proto representation. func Tier2AlphaInstanceReadonlyRecipeStepsQuotaRequestDeltasToProto(o *alpha.InstanceReadonlyRecipeStepsQuotaRequestDeltas) *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsQuotaRequestDeltas { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReadonlyRecipeStepsQuotaRequestDeltas{ MetricName: dcl.ValueOrEmptyString(o.MetricName), Amount: dcl.ValueOrEmptyInt64(o.Amount), QuotaLocationName: dcl.ValueOrEmptyString(o.QuotaLocationName), } return p } // InstanceReadonlyRecipeStepsPreprocessUpdateToProto converts a InstanceReadonlyRecipeStepsPreprocessUpdate resource to its proto representation. func Tier2AlphaInstanceReadonlyRecipeStepsPreprocessUpdateToProto(o *alpha.InstanceReadonlyRecipeStepsPreprocessUpdate) *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsPreprocessUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReadonlyRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.ValueOrEmptyString(o.LatencySloBucketName), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), } return p } // InstanceReadonlyRecipeStepsRequestedTenantProjectToProto converts a InstanceReadonlyRecipeStepsRequestedTenantProject resource to its proto representation. func Tier2AlphaInstanceReadonlyRecipeStepsRequestedTenantProjectToProto(o *alpha.InstanceReadonlyRecipeStepsRequestedTenantProject) *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsRequestedTenantProject { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReadonlyRecipeStepsRequestedTenantProject{ Tag: dcl.ValueOrEmptyString(o.Tag), Folder: dcl.ValueOrEmptyString(o.Folder), Scope: Tier2AlphaInstanceReadonlyRecipeStepsRequestedTenantProjectScopeEnumToProto(o.Scope), } return p } // InstanceReadonlyRecipeStepsPermissionsInfoToProto converts a InstanceReadonlyRecipeStepsPermissionsInfo resource to its proto representation. func Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoToProto(o *alpha.InstanceReadonlyRecipeStepsPermissionsInfo) *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfo{ PolicyName: Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoPolicyNameToProto(o.PolicyName), ResourcePath: dcl.ValueOrEmptyString(o.ResourcePath), ApiAttrs: Tier2AlphaInstanceGoogleprotobufstructToProto(o.ApiAttrs), PolicyNameMode: Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(o.PolicyNameMode), Resource: Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoResourceToProto(o.Resource), } for _, r := range o.IamPermissions { p.IamPermissions = append(p.IamPermissions, Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoIamPermissionsToProto(&r)) } return p } // InstanceReadonlyRecipeStepsPermissionsInfoPolicyNameToProto converts a InstanceReadonlyRecipeStepsPermissionsInfoPolicyName resource to its proto representation. func Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoPolicyNameToProto(o *alpha.InstanceReadonlyRecipeStepsPermissionsInfoPolicyName) *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoPolicyName { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoPolicyName{ Type: dcl.ValueOrEmptyString(o.Type), Id: dcl.ValueOrEmptyString(o.Id), Region: dcl.ValueOrEmptyString(o.Region), } return p } // InstanceReadonlyRecipeStepsPermissionsInfoIamPermissionsToProto converts a InstanceReadonlyRecipeStepsPermissionsInfoIamPermissions resource to its proto representation. func Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoIamPermissionsToProto(o *alpha.InstanceReadonlyRecipeStepsPermissionsInfoIamPermissions) *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoIamPermissions { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.ValueOrEmptyString(o.Permission), } return p } // InstanceReadonlyRecipeStepsPermissionsInfoResourceToProto converts a InstanceReadonlyRecipeStepsPermissionsInfoResource resource to its proto representation. func Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoResourceToProto(o *alpha.InstanceReadonlyRecipeStepsPermissionsInfoResource) *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoResource { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReadonlyRecipeStepsPermissionsInfoResource{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), Service: dcl.ValueOrEmptyString(o.Service), } p.Labels = make(map[string]string) for k, r := range o.Labels { p.Labels[k] = r } return p } // InstanceReadonlyRecipeStepsKeyNotificationsUpdateToProto converts a InstanceReadonlyRecipeStepsKeyNotificationsUpdate resource to its proto representation. func Tier2AlphaInstanceReadonlyRecipeStepsKeyNotificationsUpdateToProto(o *alpha.InstanceReadonlyRecipeStepsKeyNotificationsUpdate) *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsKeyNotificationsUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReadonlyRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: Tier2AlphaInstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o.KeyNotificationsInfo), } return p } // InstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto converts a InstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource to its proto representation. func Tier2AlphaInstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o *alpha.InstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.ValueOrEmptyInt64(o.DataVersion), Delegate: dcl.ValueOrEmptyString(o.Delegate), } for _, r := range o.KeyNotificationConfigs { p.KeyNotificationConfigs = append(p.KeyNotificationConfigs, Tier2AlphaInstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(&r)) } return p } // InstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto converts a InstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource to its proto representation. func Tier2AlphaInstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(o *alpha.InstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alphapb.Tier2AlphaInstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReadonlyRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.ValueOrEmptyString(o.KeyOrVersionName), Grant: dcl.ValueOrEmptyString(o.Grant), DelegatorGaiaId: dcl.ValueOrEmptyInt64(o.DelegatorGaiaId), } return p } // InstanceReconcileRecipeToProto converts a InstanceReconcileRecipe resource to its proto representation. func Tier2AlphaInstanceReconcileRecipeToProto(o *alpha.InstanceReconcileRecipe) *alphapb.Tier2AlphaInstanceReconcileRecipe { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReconcileRecipe{ HonorCancelRequest: dcl.ValueOrEmptyBool(o.HonorCancelRequest), IgnoreRecipeAfter: dcl.ValueOrEmptyInt64(o.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.ValueOrEmptyDouble(o.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.ValueOrEmptyBool(o.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.ValueOrEmptyString(o.ReadonlyRecipeStartTime), DelayToStoreResourcesInClhDbNanos: dcl.ValueOrEmptyInt64(o.DelayToStoreResourcesInClhDbNanos), } for _, r := range o.Steps { p.Steps = append(p.Steps, Tier2AlphaInstanceReconcileRecipeStepsToProto(&r)) } for _, r := range o.ResourceNamesStoredInClhWithDelay { p.ResourceNamesStoredInClhWithDelay = append(p.ResourceNamesStoredInClhWithDelay, r) } return p } // InstanceReconcileRecipeStepsToProto converts a InstanceReconcileRecipeSteps resource to its proto representation. func Tier2AlphaInstanceReconcileRecipeStepsToProto(o *alpha.InstanceReconcileRecipeSteps) *alphapb.Tier2AlphaInstanceReconcileRecipeSteps { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReconcileRecipeSteps{ RelativeTime: dcl.ValueOrEmptyInt64(o.RelativeTime), SleepDuration: dcl.ValueOrEmptyInt64(o.SleepDuration), Action: Tier2AlphaInstanceReconcileRecipeStepsActionEnumToProto(o.Action), Status: Tier2AlphaInstanceReconcileRecipeStepsStatusToProto(o.Status), ErrorSpace: dcl.ValueOrEmptyString(o.ErrorSpace), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), ResourceMetadataSize: dcl.ValueOrEmptyInt64(o.ResourceMetadataSize), Description: dcl.ValueOrEmptyString(o.Description), UpdatedRepeatOperationDelaySec: dcl.ValueOrEmptyDouble(o.UpdatedRepeatOperationDelaySec), PreprocessUpdate: Tier2AlphaInstanceReconcileRecipeStepsPreprocessUpdateToProto(o.PreprocessUpdate), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), RequestedTenantProject: Tier2AlphaInstanceReconcileRecipeStepsRequestedTenantProjectToProto(o.RequestedTenantProject), KeyNotificationsUpdate: Tier2AlphaInstanceReconcileRecipeStepsKeyNotificationsUpdateToProto(o.KeyNotificationsUpdate), ClhDataUpdateTime: dcl.ValueOrEmptyString(o.ClhDataUpdateTime), PublicErrorMessage: dcl.ValueOrEmptyString(o.PublicErrorMessage), } for _, r := range o.QuotaRequestDeltas { p.QuotaRequestDeltas = append(p.QuotaRequestDeltas, Tier2AlphaInstanceReconcileRecipeStepsQuotaRequestDeltasToProto(&r)) } for _, r := range o.PermissionsInfo { p.PermissionsInfo = append(p.PermissionsInfo, Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoToProto(&r)) } return p } // InstanceReconcileRecipeStepsStatusToProto converts a InstanceReconcileRecipeStepsStatus resource to its proto representation. func Tier2AlphaInstanceReconcileRecipeStepsStatusToProto(o *alpha.InstanceReconcileRecipeStepsStatus) *alphapb.Tier2AlphaInstanceReconcileRecipeStepsStatus { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReconcileRecipeStepsStatus{ Code: dcl.ValueOrEmptyInt64(o.Code), Message: dcl.ValueOrEmptyString(o.Message), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstanceReconcileRecipeStepsStatusDetailsToProto(&r)) } return p } // InstanceReconcileRecipeStepsStatusDetailsToProto converts a InstanceReconcileRecipeStepsStatusDetails resource to its proto representation. func Tier2AlphaInstanceReconcileRecipeStepsStatusDetailsToProto(o *alpha.InstanceReconcileRecipeStepsStatusDetails) *alphapb.Tier2AlphaInstanceReconcileRecipeStepsStatusDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReconcileRecipeStepsStatusDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstanceReconcileRecipeStepsQuotaRequestDeltasToProto converts a InstanceReconcileRecipeStepsQuotaRequestDeltas resource to its proto representation. func Tier2AlphaInstanceReconcileRecipeStepsQuotaRequestDeltasToProto(o *alpha.InstanceReconcileRecipeStepsQuotaRequestDeltas) *alphapb.Tier2AlphaInstanceReconcileRecipeStepsQuotaRequestDeltas { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReconcileRecipeStepsQuotaRequestDeltas{ MetricName: dcl.ValueOrEmptyString(o.MetricName), Amount: dcl.ValueOrEmptyInt64(o.Amount), QuotaLocationName: dcl.ValueOrEmptyString(o.QuotaLocationName), } return p } // InstanceReconcileRecipeStepsPreprocessUpdateToProto converts a InstanceReconcileRecipeStepsPreprocessUpdate resource to its proto representation. func Tier2AlphaInstanceReconcileRecipeStepsPreprocessUpdateToProto(o *alpha.InstanceReconcileRecipeStepsPreprocessUpdate) *alphapb.Tier2AlphaInstanceReconcileRecipeStepsPreprocessUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReconcileRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.ValueOrEmptyString(o.LatencySloBucketName), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), } return p } // InstanceReconcileRecipeStepsRequestedTenantProjectToProto converts a InstanceReconcileRecipeStepsRequestedTenantProject resource to its proto representation. func Tier2AlphaInstanceReconcileRecipeStepsRequestedTenantProjectToProto(o *alpha.InstanceReconcileRecipeStepsRequestedTenantProject) *alphapb.Tier2AlphaInstanceReconcileRecipeStepsRequestedTenantProject { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReconcileRecipeStepsRequestedTenantProject{ Tag: dcl.ValueOrEmptyString(o.Tag), Folder: dcl.ValueOrEmptyString(o.Folder), Scope: Tier2AlphaInstanceReconcileRecipeStepsRequestedTenantProjectScopeEnumToProto(o.Scope), } return p } // InstanceReconcileRecipeStepsPermissionsInfoToProto converts a InstanceReconcileRecipeStepsPermissionsInfo resource to its proto representation. func Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoToProto(o *alpha.InstanceReconcileRecipeStepsPermissionsInfo) *alphapb.Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfo{ PolicyName: Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoPolicyNameToProto(o.PolicyName), ResourcePath: dcl.ValueOrEmptyString(o.ResourcePath), ApiAttrs: Tier2AlphaInstanceGoogleprotobufstructToProto(o.ApiAttrs), PolicyNameMode: Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(o.PolicyNameMode), Resource: Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoResourceToProto(o.Resource), } for _, r := range o.IamPermissions { p.IamPermissions = append(p.IamPermissions, Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoIamPermissionsToProto(&r)) } return p } // InstanceReconcileRecipeStepsPermissionsInfoPolicyNameToProto converts a InstanceReconcileRecipeStepsPermissionsInfoPolicyName resource to its proto representation. func Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoPolicyNameToProto(o *alpha.InstanceReconcileRecipeStepsPermissionsInfoPolicyName) *alphapb.Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoPolicyName { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoPolicyName{ Type: dcl.ValueOrEmptyString(o.Type), Id: dcl.ValueOrEmptyString(o.Id), Region: dcl.ValueOrEmptyString(o.Region), } return p } // InstanceReconcileRecipeStepsPermissionsInfoIamPermissionsToProto converts a InstanceReconcileRecipeStepsPermissionsInfoIamPermissions resource to its proto representation. func Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoIamPermissionsToProto(o *alpha.InstanceReconcileRecipeStepsPermissionsInfoIamPermissions) *alphapb.Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoIamPermissions { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.ValueOrEmptyString(o.Permission), } return p } // InstanceReconcileRecipeStepsPermissionsInfoResourceToProto converts a InstanceReconcileRecipeStepsPermissionsInfoResource resource to its proto representation. func Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoResourceToProto(o *alpha.InstanceReconcileRecipeStepsPermissionsInfoResource) *alphapb.Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoResource { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReconcileRecipeStepsPermissionsInfoResource{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), Service: dcl.ValueOrEmptyString(o.Service), } p.Labels = make(map[string]string) for k, r := range o.Labels { p.Labels[k] = r } return p } // InstanceReconcileRecipeStepsKeyNotificationsUpdateToProto converts a InstanceReconcileRecipeStepsKeyNotificationsUpdate resource to its proto representation. func Tier2AlphaInstanceReconcileRecipeStepsKeyNotificationsUpdateToProto(o *alpha.InstanceReconcileRecipeStepsKeyNotificationsUpdate) *alphapb.Tier2AlphaInstanceReconcileRecipeStepsKeyNotificationsUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReconcileRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: Tier2AlphaInstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o.KeyNotificationsInfo), } return p } // InstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto converts a InstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource to its proto representation. func Tier2AlphaInstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o *alpha.InstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alphapb.Tier2AlphaInstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.ValueOrEmptyInt64(o.DataVersion), Delegate: dcl.ValueOrEmptyString(o.Delegate), } for _, r := range o.KeyNotificationConfigs { p.KeyNotificationConfigs = append(p.KeyNotificationConfigs, Tier2AlphaInstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(&r)) } return p } // InstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto converts a InstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource to its proto representation. func Tier2AlphaInstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(o *alpha.InstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alphapb.Tier2AlphaInstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.ValueOrEmptyString(o.KeyOrVersionName), Grant: dcl.ValueOrEmptyString(o.Grant), DelegatorGaiaId: dcl.ValueOrEmptyInt64(o.DelegatorGaiaId), } return p } // InstancePreprocessPassthroughRecipeToProto converts a InstancePreprocessPassthroughRecipe resource to its proto representation. func Tier2AlphaInstancePreprocessPassthroughRecipeToProto(o *alpha.InstancePreprocessPassthroughRecipe) *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipe { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessPassthroughRecipe{ HonorCancelRequest: dcl.ValueOrEmptyBool(o.HonorCancelRequest), IgnoreRecipeAfter: dcl.ValueOrEmptyInt64(o.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.ValueOrEmptyDouble(o.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.ValueOrEmptyBool(o.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.ValueOrEmptyString(o.ReadonlyRecipeStartTime), DelayToStoreResourcesInClhDbNanos: dcl.ValueOrEmptyInt64(o.DelayToStoreResourcesInClhDbNanos), } for _, r := range o.Steps { p.Steps = append(p.Steps, Tier2AlphaInstancePreprocessPassthroughRecipeStepsToProto(&r)) } for _, r := range o.ResourceNamesStoredInClhWithDelay { p.ResourceNamesStoredInClhWithDelay = append(p.ResourceNamesStoredInClhWithDelay, r) } return p } // InstancePreprocessPassthroughRecipeStepsToProto converts a InstancePreprocessPassthroughRecipeSteps resource to its proto representation. func Tier2AlphaInstancePreprocessPassthroughRecipeStepsToProto(o *alpha.InstancePreprocessPassthroughRecipeSteps) *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeSteps { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeSteps{ RelativeTime: dcl.ValueOrEmptyInt64(o.RelativeTime), SleepDuration: dcl.ValueOrEmptyInt64(o.SleepDuration), Action: Tier2AlphaInstancePreprocessPassthroughRecipeStepsActionEnumToProto(o.Action), Status: Tier2AlphaInstancePreprocessPassthroughRecipeStepsStatusToProto(o.Status), ErrorSpace: dcl.ValueOrEmptyString(o.ErrorSpace), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), ResourceMetadataSize: dcl.ValueOrEmptyInt64(o.ResourceMetadataSize), Description: dcl.ValueOrEmptyString(o.Description), UpdatedRepeatOperationDelaySec: dcl.ValueOrEmptyDouble(o.UpdatedRepeatOperationDelaySec), PreprocessUpdate: Tier2AlphaInstancePreprocessPassthroughRecipeStepsPreprocessUpdateToProto(o.PreprocessUpdate), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), RequestedTenantProject: Tier2AlphaInstancePreprocessPassthroughRecipeStepsRequestedTenantProjectToProto(o.RequestedTenantProject), KeyNotificationsUpdate: Tier2AlphaInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateToProto(o.KeyNotificationsUpdate), ClhDataUpdateTime: dcl.ValueOrEmptyString(o.ClhDataUpdateTime), PublicErrorMessage: dcl.ValueOrEmptyString(o.PublicErrorMessage), } for _, r := range o.QuotaRequestDeltas { p.QuotaRequestDeltas = append(p.QuotaRequestDeltas, Tier2AlphaInstancePreprocessPassthroughRecipeStepsQuotaRequestDeltasToProto(&r)) } for _, r := range o.PermissionsInfo { p.PermissionsInfo = append(p.PermissionsInfo, Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoToProto(&r)) } return p } // InstancePreprocessPassthroughRecipeStepsStatusToProto converts a InstancePreprocessPassthroughRecipeStepsStatus resource to its proto representation. func Tier2AlphaInstancePreprocessPassthroughRecipeStepsStatusToProto(o *alpha.InstancePreprocessPassthroughRecipeStepsStatus) *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsStatus { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsStatus{ Code: dcl.ValueOrEmptyInt64(o.Code), Message: dcl.ValueOrEmptyString(o.Message), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstancePreprocessPassthroughRecipeStepsStatusDetailsToProto(&r)) } return p } // InstancePreprocessPassthroughRecipeStepsStatusDetailsToProto converts a InstancePreprocessPassthroughRecipeStepsStatusDetails resource to its proto representation. func Tier2AlphaInstancePreprocessPassthroughRecipeStepsStatusDetailsToProto(o *alpha.InstancePreprocessPassthroughRecipeStepsStatusDetails) *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsStatusDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsStatusDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstancePreprocessPassthroughRecipeStepsQuotaRequestDeltasToProto converts a InstancePreprocessPassthroughRecipeStepsQuotaRequestDeltas resource to its proto representation. func Tier2AlphaInstancePreprocessPassthroughRecipeStepsQuotaRequestDeltasToProto(o *alpha.InstancePreprocessPassthroughRecipeStepsQuotaRequestDeltas) *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsQuotaRequestDeltas { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsQuotaRequestDeltas{ MetricName: dcl.ValueOrEmptyString(o.MetricName), Amount: dcl.ValueOrEmptyInt64(o.Amount), QuotaLocationName: dcl.ValueOrEmptyString(o.QuotaLocationName), } return p } // InstancePreprocessPassthroughRecipeStepsPreprocessUpdateToProto converts a InstancePreprocessPassthroughRecipeStepsPreprocessUpdate resource to its proto representation. func Tier2AlphaInstancePreprocessPassthroughRecipeStepsPreprocessUpdateToProto(o *alpha.InstancePreprocessPassthroughRecipeStepsPreprocessUpdate) *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsPreprocessUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.ValueOrEmptyString(o.LatencySloBucketName), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), } return p } // InstancePreprocessPassthroughRecipeStepsRequestedTenantProjectToProto converts a InstancePreprocessPassthroughRecipeStepsRequestedTenantProject resource to its proto representation. func Tier2AlphaInstancePreprocessPassthroughRecipeStepsRequestedTenantProjectToProto(o *alpha.InstancePreprocessPassthroughRecipeStepsRequestedTenantProject) *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsRequestedTenantProject { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsRequestedTenantProject{ Tag: dcl.ValueOrEmptyString(o.Tag), Folder: dcl.ValueOrEmptyString(o.Folder), Scope: Tier2AlphaInstancePreprocessPassthroughRecipeStepsRequestedTenantProjectScopeEnumToProto(o.Scope), } return p } // InstancePreprocessPassthroughRecipeStepsPermissionsInfoToProto converts a InstancePreprocessPassthroughRecipeStepsPermissionsInfo resource to its proto representation. func Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoToProto(o *alpha.InstancePreprocessPassthroughRecipeStepsPermissionsInfo) *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfo{ PolicyName: Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyNameToProto(o.PolicyName), ResourcePath: dcl.ValueOrEmptyString(o.ResourcePath), ApiAttrs: Tier2AlphaInstanceGoogleprotobufstructToProto(o.ApiAttrs), PolicyNameMode: Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(o.PolicyNameMode), Resource: Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoResourceToProto(o.Resource), } for _, r := range o.IamPermissions { p.IamPermissions = append(p.IamPermissions, Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoIamPermissionsToProto(&r)) } return p } // InstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyNameToProto converts a InstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyName resource to its proto representation. func Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyNameToProto(o *alpha.InstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyName) *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyName { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoPolicyName{ Type: dcl.ValueOrEmptyString(o.Type), Id: dcl.ValueOrEmptyString(o.Id), Region: dcl.ValueOrEmptyString(o.Region), } return p } // InstancePreprocessPassthroughRecipeStepsPermissionsInfoIamPermissionsToProto converts a InstancePreprocessPassthroughRecipeStepsPermissionsInfoIamPermissions resource to its proto representation. func Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoIamPermissionsToProto(o *alpha.InstancePreprocessPassthroughRecipeStepsPermissionsInfoIamPermissions) *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoIamPermissions { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.ValueOrEmptyString(o.Permission), } return p } // InstancePreprocessPassthroughRecipeStepsPermissionsInfoResourceToProto converts a InstancePreprocessPassthroughRecipeStepsPermissionsInfoResource resource to its proto representation. func Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoResourceToProto(o *alpha.InstancePreprocessPassthroughRecipeStepsPermissionsInfoResource) *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoResource { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsPermissionsInfoResource{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), Service: dcl.ValueOrEmptyString(o.Service), } p.Labels = make(map[string]string) for k, r := range o.Labels { p.Labels[k] = r } return p } // InstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateToProto converts a InstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdate resource to its proto representation. func Tier2AlphaInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateToProto(o *alpha.InstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdate) *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: Tier2AlphaInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o.KeyNotificationsInfo), } return p } // InstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto converts a InstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource to its proto representation. func Tier2AlphaInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o *alpha.InstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.ValueOrEmptyInt64(o.DataVersion), Delegate: dcl.ValueOrEmptyString(o.Delegate), } for _, r := range o.KeyNotificationConfigs { p.KeyNotificationConfigs = append(p.KeyNotificationConfigs, Tier2AlphaInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(&r)) } return p } // InstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto converts a InstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource to its proto representation. func Tier2AlphaInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(o *alpha.InstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessPassthroughRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.ValueOrEmptyString(o.KeyOrVersionName), Grant: dcl.ValueOrEmptyString(o.Grant), DelegatorGaiaId: dcl.ValueOrEmptyInt64(o.DelegatorGaiaId), } return p } // InstancePreprocessReconcileRecipeToProto converts a InstancePreprocessReconcileRecipe resource to its proto representation. func Tier2AlphaInstancePreprocessReconcileRecipeToProto(o *alpha.InstancePreprocessReconcileRecipe) *alphapb.Tier2AlphaInstancePreprocessReconcileRecipe { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReconcileRecipe{ HonorCancelRequest: dcl.ValueOrEmptyBool(o.HonorCancelRequest), IgnoreRecipeAfter: dcl.ValueOrEmptyInt64(o.IgnoreRecipeAfter), VerifyDeadlineSecondsBelow: dcl.ValueOrEmptyDouble(o.VerifyDeadlineSecondsBelow), PopulateOperationResult: dcl.ValueOrEmptyBool(o.PopulateOperationResult), ReadonlyRecipeStartTime: dcl.ValueOrEmptyString(o.ReadonlyRecipeStartTime), DelayToStoreResourcesInClhDbNanos: dcl.ValueOrEmptyInt64(o.DelayToStoreResourcesInClhDbNanos), } for _, r := range o.Steps { p.Steps = append(p.Steps, Tier2AlphaInstancePreprocessReconcileRecipeStepsToProto(&r)) } for _, r := range o.ResourceNamesStoredInClhWithDelay { p.ResourceNamesStoredInClhWithDelay = append(p.ResourceNamesStoredInClhWithDelay, r) } return p } // InstancePreprocessReconcileRecipeStepsToProto converts a InstancePreprocessReconcileRecipeSteps resource to its proto representation. func Tier2AlphaInstancePreprocessReconcileRecipeStepsToProto(o *alpha.InstancePreprocessReconcileRecipeSteps) *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeSteps { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReconcileRecipeSteps{ RelativeTime: dcl.ValueOrEmptyInt64(o.RelativeTime), SleepDuration: dcl.ValueOrEmptyInt64(o.SleepDuration), Action: Tier2AlphaInstancePreprocessReconcileRecipeStepsActionEnumToProto(o.Action), Status: Tier2AlphaInstancePreprocessReconcileRecipeStepsStatusToProto(o.Status), ErrorSpace: dcl.ValueOrEmptyString(o.ErrorSpace), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), ResourceMetadataSize: dcl.ValueOrEmptyInt64(o.ResourceMetadataSize), Description: dcl.ValueOrEmptyString(o.Description), UpdatedRepeatOperationDelaySec: dcl.ValueOrEmptyDouble(o.UpdatedRepeatOperationDelaySec), PreprocessUpdate: Tier2AlphaInstancePreprocessReconcileRecipeStepsPreprocessUpdateToProto(o.PreprocessUpdate), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), RequestedTenantProject: Tier2AlphaInstancePreprocessReconcileRecipeStepsRequestedTenantProjectToProto(o.RequestedTenantProject), KeyNotificationsUpdate: Tier2AlphaInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateToProto(o.KeyNotificationsUpdate), ClhDataUpdateTime: dcl.ValueOrEmptyString(o.ClhDataUpdateTime), PublicErrorMessage: dcl.ValueOrEmptyString(o.PublicErrorMessage), } for _, r := range o.QuotaRequestDeltas { p.QuotaRequestDeltas = append(p.QuotaRequestDeltas, Tier2AlphaInstancePreprocessReconcileRecipeStepsQuotaRequestDeltasToProto(&r)) } for _, r := range o.PermissionsInfo { p.PermissionsInfo = append(p.PermissionsInfo, Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoToProto(&r)) } return p } // InstancePreprocessReconcileRecipeStepsStatusToProto converts a InstancePreprocessReconcileRecipeStepsStatus resource to its proto representation. func Tier2AlphaInstancePreprocessReconcileRecipeStepsStatusToProto(o *alpha.InstancePreprocessReconcileRecipeStepsStatus) *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsStatus { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsStatus{ Code: dcl.ValueOrEmptyInt64(o.Code), Message: dcl.ValueOrEmptyString(o.Message), } for _, r := range o.Details { p.Details = append(p.Details, Tier2AlphaInstancePreprocessReconcileRecipeStepsStatusDetailsToProto(&r)) } return p } // InstancePreprocessReconcileRecipeStepsStatusDetailsToProto converts a InstancePreprocessReconcileRecipeStepsStatusDetails resource to its proto representation. func Tier2AlphaInstancePreprocessReconcileRecipeStepsStatusDetailsToProto(o *alpha.InstancePreprocessReconcileRecipeStepsStatusDetails) *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsStatusDetails { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsStatusDetails{ TypeUrl: dcl.ValueOrEmptyString(o.TypeUrl), Value: dcl.ValueOrEmptyString(o.Value), } return p } // InstancePreprocessReconcileRecipeStepsQuotaRequestDeltasToProto converts a InstancePreprocessReconcileRecipeStepsQuotaRequestDeltas resource to its proto representation. func Tier2AlphaInstancePreprocessReconcileRecipeStepsQuotaRequestDeltasToProto(o *alpha.InstancePreprocessReconcileRecipeStepsQuotaRequestDeltas) *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsQuotaRequestDeltas { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsQuotaRequestDeltas{ MetricName: dcl.ValueOrEmptyString(o.MetricName), Amount: dcl.ValueOrEmptyInt64(o.Amount), QuotaLocationName: dcl.ValueOrEmptyString(o.QuotaLocationName), } return p } // InstancePreprocessReconcileRecipeStepsPreprocessUpdateToProto converts a InstancePreprocessReconcileRecipeStepsPreprocessUpdate resource to its proto representation. func Tier2AlphaInstancePreprocessReconcileRecipeStepsPreprocessUpdateToProto(o *alpha.InstancePreprocessReconcileRecipeStepsPreprocessUpdate) *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsPreprocessUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsPreprocessUpdate{ LatencySloBucketName: dcl.ValueOrEmptyString(o.LatencySloBucketName), PublicOperationMetadata: dcl.ValueOrEmptyString(o.PublicOperationMetadata), } return p } // InstancePreprocessReconcileRecipeStepsRequestedTenantProjectToProto converts a InstancePreprocessReconcileRecipeStepsRequestedTenantProject resource to its proto representation. func Tier2AlphaInstancePreprocessReconcileRecipeStepsRequestedTenantProjectToProto(o *alpha.InstancePreprocessReconcileRecipeStepsRequestedTenantProject) *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsRequestedTenantProject { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsRequestedTenantProject{ Tag: dcl.ValueOrEmptyString(o.Tag), Folder: dcl.ValueOrEmptyString(o.Folder), Scope: Tier2AlphaInstancePreprocessReconcileRecipeStepsRequestedTenantProjectScopeEnumToProto(o.Scope), } return p } // InstancePreprocessReconcileRecipeStepsPermissionsInfoToProto converts a InstancePreprocessReconcileRecipeStepsPermissionsInfo resource to its proto representation. func Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoToProto(o *alpha.InstancePreprocessReconcileRecipeStepsPermissionsInfo) *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfo{ PolicyName: Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyNameToProto(o.PolicyName), ResourcePath: dcl.ValueOrEmptyString(o.ResourcePath), ApiAttrs: Tier2AlphaInstanceGoogleprotobufstructToProto(o.ApiAttrs), PolicyNameMode: Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyNameModeEnumToProto(o.PolicyNameMode), Resource: Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoResourceToProto(o.Resource), } for _, r := range o.IamPermissions { p.IamPermissions = append(p.IamPermissions, Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoIamPermissionsToProto(&r)) } return p } // InstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyNameToProto converts a InstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyName resource to its proto representation. func Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyNameToProto(o *alpha.InstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyName) *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyName { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoPolicyName{ Type: dcl.ValueOrEmptyString(o.Type), Id: dcl.ValueOrEmptyString(o.Id), Region: dcl.ValueOrEmptyString(o.Region), } return p } // InstancePreprocessReconcileRecipeStepsPermissionsInfoIamPermissionsToProto converts a InstancePreprocessReconcileRecipeStepsPermissionsInfoIamPermissions resource to its proto representation. func Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoIamPermissionsToProto(o *alpha.InstancePreprocessReconcileRecipeStepsPermissionsInfoIamPermissions) *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoIamPermissions { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoIamPermissions{ Permission: dcl.ValueOrEmptyString(o.Permission), } return p } // InstancePreprocessReconcileRecipeStepsPermissionsInfoResourceToProto converts a InstancePreprocessReconcileRecipeStepsPermissionsInfoResource resource to its proto representation. func Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoResourceToProto(o *alpha.InstancePreprocessReconcileRecipeStepsPermissionsInfoResource) *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoResource { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsPermissionsInfoResource{ Name: dcl.ValueOrEmptyString(o.Name), Type: dcl.ValueOrEmptyString(o.Type), Service: dcl.ValueOrEmptyString(o.Service), } p.Labels = make(map[string]string) for k, r := range o.Labels { p.Labels[k] = r } return p } // InstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateToProto converts a InstancePreprocessReconcileRecipeStepsKeyNotificationsUpdate resource to its proto representation. func Tier2AlphaInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateToProto(o *alpha.InstancePreprocessReconcileRecipeStepsKeyNotificationsUpdate) *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdate { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdate{ KeyNotificationsInfo: Tier2AlphaInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o.KeyNotificationsInfo), } return p } // InstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto converts a InstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo resource to its proto representation. func Tier2AlphaInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoToProto(o *alpha.InstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo) *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfo{ DataVersion: dcl.ValueOrEmptyInt64(o.DataVersion), Delegate: dcl.ValueOrEmptyString(o.Delegate), } for _, r := range o.KeyNotificationConfigs { p.KeyNotificationConfigs = append(p.KeyNotificationConfigs, Tier2AlphaInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(&r)) } return p } // InstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto converts a InstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs resource to its proto representation. func Tier2AlphaInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigsToProto(o *alpha.InstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs) *alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs { if o == nil { return nil } p := &alphapb.Tier2AlphaInstancePreprocessReconcileRecipeStepsKeyNotificationsUpdateKeyNotificationsInfoKeyNotificationConfigs{ KeyOrVersionName: dcl.ValueOrEmptyString(o.KeyOrVersionName), Grant: dcl.ValueOrEmptyString(o.Grant), DelegatorGaiaId: dcl.ValueOrEmptyInt64(o.DelegatorGaiaId), } return p } // InstanceHistoryToProto converts a InstanceHistory resource to its proto representation. func Tier2AlphaInstanceHistoryToProto(o *alpha.InstanceHistory) *alphapb.Tier2AlphaInstanceHistory { if o == nil { return nil } p := &alphapb.Tier2AlphaInstanceHistory{ Timestamp: dcl.ValueOrEmptyString(o.Timestamp), OperationHandle: dcl.ValueOrEmptyString(o.OperationHandle), Description: dcl.ValueOrEmptyString(o.Description), StepIndex: dcl.ValueOrEmptyInt64(o.StepIndex), TenantProjectNumber: dcl.ValueOrEmptyInt64(o.TenantProjectNumber), TenantProjectId: dcl.ValueOrEmptyString(o.TenantProjectId), P4ServiceAccount: dcl.ValueOrEmptyString(o.P4ServiceAccount), } return p } // InstanceToProto converts a Instance resource to its proto representation. func InstanceToProto(resource *alpha.Instance) *alphapb.Tier2AlphaInstance { p := &alphapb.Tier2AlphaInstance{ Name: dcl.ValueOrEmptyString(resource.Name), DisplayName: dcl.ValueOrEmptyString(resource.DisplayName), Zone: dcl.ValueOrEmptyString(resource.Zone), AlternativeZone: dcl.ValueOrEmptyString(resource.AlternativeZone), Sku: Tier2AlphaInstanceSkuToProto(resource.Sku), AuthorizedNetworkId: dcl.ValueOrEmptyString(resource.AuthorizedNetworkId), ReservedIpRange: dcl.ValueOrEmptyString(resource.ReservedIPRange), Host: dcl.ValueOrEmptyString(resource.Host), Port: dcl.ValueOrEmptyInt64(resource.Port), CurrentZone: dcl.ValueOrEmptyString(resource.CurrentZone), CreateTime: dcl.ValueOrEmptyString(resource.CreateTime), State: Tier2AlphaInstanceStateEnumToProto(resource.State), StatusMessage: dcl.ValueOrEmptyString(resource.StatusMessage), UpdateTime: dcl.ValueOrEmptyString(resource.UpdateTime), MutateUserId: dcl.ValueOrEmptyInt64(resource.MutateUserId), ReadUserId: dcl.ValueOrEmptyInt64(resource.ReadUserId), PreprocessCreateRecipe: Tier2AlphaInstancePreprocessCreateRecipeToProto(resource.PreprocessCreateRecipe), CreateRecipe: Tier2AlphaInstanceCreateRecipeToProto(resource.CreateRecipe), DeleteRecipe: Tier2AlphaInstanceDeleteRecipeToProto(resource.DeleteRecipe), UpdateRecipe: Tier2AlphaInstanceUpdateRecipeToProto(resource.UpdateRecipe), PreprocessResetRecipe: Tier2AlphaInstancePreprocessResetRecipeToProto(resource.PreprocessResetRecipe), ResetRecipe: Tier2AlphaInstanceResetRecipeToProto(resource.ResetRecipe), PreprocessRepairRecipe: Tier2AlphaInstancePreprocessRepairRecipeToProto(resource.PreprocessRepairRecipe), RepairRecipe: Tier2AlphaInstanceRepairRecipeToProto(resource.RepairRecipe), PreprocessDeleteRecipe: Tier2AlphaInstancePreprocessDeleteRecipeToProto(resource.PreprocessDeleteRecipe), PreprocessUpdateRecipe: Tier2AlphaInstancePreprocessUpdateRecipeToProto(resource.PreprocessUpdateRecipe), PreprocessFreezeRecipe: Tier2AlphaInstancePreprocessFreezeRecipeToProto(resource.PreprocessFreezeRecipe), FreezeRecipe: Tier2AlphaInstanceFreezeRecipeToProto(resource.FreezeRecipe), PreprocessUnfreezeRecipe: Tier2AlphaInstancePreprocessUnfreezeRecipeToProto(resource.PreprocessUnfreezeRecipe), UnfreezeRecipe: Tier2AlphaInstanceUnfreezeRecipeToProto(resource.UnfreezeRecipe), PreprocessReportInstanceHealthRecipe: Tier2AlphaInstancePreprocessReportInstanceHealthRecipeToProto(resource.PreprocessReportInstanceHealthRecipe), ReportInstanceHealthRecipe: Tier2AlphaInstanceReportInstanceHealthRecipeToProto(resource.ReportInstanceHealthRecipe), PreprocessGetRecipe: Tier2AlphaInstancePreprocessGetRecipeToProto(resource.PreprocessGetRecipe), NotifyKeyAvailableRecipe: Tier2AlphaInstanceNotifyKeyAvailableRecipeToProto(resource.NotifyKeyAvailableRecipe), NotifyKeyUnavailableRecipe: Tier2AlphaInstanceNotifyKeyUnavailableRecipeToProto(resource.NotifyKeyUnavailableRecipe), ReadonlyRecipe: Tier2AlphaInstanceReadonlyRecipeToProto(resource.ReadonlyRecipe), ReconcileRecipe: Tier2AlphaInstanceReconcileRecipeToProto(resource.ReconcileRecipe), PreprocessPassthroughRecipe: Tier2AlphaInstancePreprocessPassthroughRecipeToProto(resource.PreprocessPassthroughRecipe), PreprocessReconcileRecipe: Tier2AlphaInstancePreprocessReconcileRecipeToProto(resource.PreprocessReconcileRecipe), EnableCallHistory: dcl.ValueOrEmptyBool(resource.EnableCallHistory), PublicResourceViewOverride: dcl.ValueOrEmptyString(resource.PublicResourceViewOverride), ExtraInfo: dcl.ValueOrEmptyString(resource.ExtraInfo), Uid: dcl.ValueOrEmptyString(resource.Uid), Etag: dcl.ValueOrEmptyString(resource.Etag), Project: dcl.ValueOrEmptyString(resource.Project), Location: dcl.ValueOrEmptyString(resource.Location), } for _, r := range resource.References { p.References = append(p.References, Tier2AlphaInstanceReferencesToProto(&r)) } for _, r := range resource.EncryptionKeys { p.EncryptionKeys = append(p.EncryptionKeys, Tier2AlphaInstanceEncryptionKeysToProto(&r)) } for _, r := range resource.History { p.History = append(p.History, Tier2AlphaInstanceHistoryToProto(&r)) } return p } // ApplyInstance handles the gRPC request by passing it to the underlying Instance Apply() method. func (s *InstanceServer) applyInstance(ctx context.Context, c *alpha.Client, request *alphapb.ApplyTier2AlphaInstanceRequest) (*alphapb.Tier2AlphaInstance, error) { p := ProtoToInstance(request.GetResource()) res, err := c.ApplyInstance(ctx, p) if err != nil { return nil, err } r := InstanceToProto(res) return r, nil } // ApplyInstance handles the gRPC request by passing it to the underlying Instance Apply() method. func (s *InstanceServer) ApplyTier2AlphaInstance(ctx context.Context, request *alphapb.ApplyTier2AlphaInstanceRequest) (*alphapb.Tier2AlphaInstance, error) { cl, err := createConfigInstance(ctx, request.ServiceAccountFile) if err != nil { return nil, err } return s.applyInstance(ctx, cl, request) } // DeleteInstance handles the gRPC request by passing it to the underlying Instance Delete() method. func (s *InstanceServer) DeleteTier2AlphaInstance(ctx context.Context, request *alphapb.DeleteTier2AlphaInstanceRequest) (*emptypb.Empty, error) { cl, err := createConfigInstance(ctx, request.ServiceAccountFile) if err != nil { return nil, err } return &emptypb.Empty{}, cl.DeleteInstance(ctx, ProtoToInstance(request.GetResource())) } // ListTier2AlphaInstance handles the gRPC request by passing it to the underlying InstanceList() method. func (s *InstanceServer) ListTier2AlphaInstance(ctx context.Context, request *alphapb.ListTier2AlphaInstanceRequest) (*alphapb.ListTier2AlphaInstanceResponse, error) { cl, err := createConfigInstance(ctx, request.ServiceAccountFile) if err != nil { return nil, err } resources, err := cl.ListInstance(ctx, ProtoToInstance(request.GetResource())) if err != nil { return nil, err } var protos []*alphapb.Tier2AlphaInstance for _, r := range resources.Items { rp := InstanceToProto(r) protos = append(protos, rp) } return &alphapb.ListTier2AlphaInstanceResponse{Items: protos}, nil } func createConfigInstance(ctx context.Context, service_account_file string) (*alpha.Client, error) { conf := dcl.NewConfig(dcl.WithUserAgent("dcl-test"), dcl.WithCredentialsFile(service_account_file)) return alpha.NewClient(conf), nil }
package impl import ( "errors" "github.com/gorilla/websocket" "sync" ) type Connection struct { wsConn *websocket.Conn outChannel chan []byte inChannel chan []byte closeChannel chan []byte mutex sync.Mutex isClosed bool } func InitCreateConnection(wsConn *websocket.Conn) (conn *Connection, err error) { conn = &Connection{ wsConn: wsConn, outChannel: make(chan []byte, 1024), inChannel: make(chan []byte, 1024), closeChannel: make(chan []byte, 1), } go conn.ReadLoop() go conn.WriteLoop() return } func (conn *Connection) ReadMessage() (data []byte, err error) { select { case data = <-conn.inChannel: case <-conn.closeChannel: err = errors.New("connection is closed") } return } func (conn *Connection) WriteMessage(data []byte) (err error) { select { case conn.outChannel <- data: case <-conn.closeChannel: err = errors.New("connection is closed") } return } func (conn *Connection) Close() { conn.wsConn.Close() conn.mutex.Lock() if !conn.isClosed { close(conn.closeChannel) conn.isClosed = true } conn.mutex.Unlock() } func (conn *Connection) ReadLoop() { var data []byte var err error for { if _, data, err = conn.wsConn.ReadMessage(); err != nil { goto ERR } select { case conn.inChannel <- data: case <-conn.closeChannel: goto ERR } } ERR: conn.Close() } func (conn *Connection) WriteLoop() { var data []byte var err error for { select { case data = <-conn.outChannel: case <-conn.closeChannel: goto ERR } if err = conn.wsConn.WriteMessage(websocket.TextMessage, data); err != nil { goto ERR } } ERR: conn.Close() }
/* Given an array of ints, return a new array length 2 containing the first and last elements from the original array. The original array will be length 1 or more. */ package main import ( "fmt" "coding_bat/utils" ) func make_ends(ints []int) []int { if len(ints) == 0 { return []int{} } else if len(ints) == 1 { return ints } else { return []int{ints[0], ints[len(ints)-1]} } } func main(){ var status int = 0 if utils.Cmp(make_ends([]int{4, 3, 6, 7, 8}), []int{4, 8}) { status += 1 } if utils.Cmp(make_ends([]int{7}), []int{7}) { status += 1 } if utils.Cmp(make_ends([]int{}), []int{}) { status += 1 } if status == 3 { fmt.Println("OK") } else { fmt.Println("NOT OK") } }
package status // ResponseDoc is a response declaration for documentatino pruposes type ResponseDoc struct { Data struct { Attributes Response `json:"attributes"` } `json:"data"` }
package main import ( "fmt" ) func main() { x := []int{11, 33, 55, 77} y := []string{"Eleven", "Thirty three", "Fifty five", "Seventy seven"} z := []int{22, 44, 66, 88} fmt.Println(x) fmt.Println(y) fmt.Println(z) ip := [][]int{x, z} fmt.Println("The value of ip:", ip) x = append(x, 99, 100) fmt.Println(x) x = append(x, z...) fmt.Println(x) fmt.Println("Deleting-------") x = append(x[2:5], x[8:]...) fmt.Println(x) y = append(y, "Eighty eight", "Ninenty Nine", "Hundred") fmt.Println(y) fmt.Println(len(y)) fmt.Println(cap(y)) y = append(y[2:5]) fmt.Println(y) fmt.Println(len(y)) fmt.Println(cap(y)) m := map[string]int{ "Digits": 4, "Number": 9, } fmt.Println(m) fmt.Println(m["Number"]) fmt.Println("Deleting-------") delete(m, "Digits") fmt.Println(m) p := map[string]string{ "Digits": "Four", "Number": "Nine", } fmt.Println(p) fmt.Println(p["age"]) v, ok := p["age"] fmt.Println(v, ok) for i, v := range ip { fmt.Println("The record of ", i) for i, j := range v { fmt.Println("\t\t", i, "\t", j) } } }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. package armhelpers import ( "testing" . "github.com/onsi/gomega" "github.com/onsi/gomega/types" ) func TestAzureStorageClient_CreateContainer(t *testing.T) { cases := []struct { name string storageClientFactory func() *MockStorageClient errMatcher types.GomegaMatcher resMatcher types.GomegaMatcher }{ { name: "ShouldPassIfCreated", storageClientFactory: func() *MockStorageClient { return &MockStorageClient{ FailCreateContainer: false, } }, errMatcher: BeNil(), resMatcher: BeTrue(), }, { name: "ShouldReturnErrorWhenCreationFails", storageClientFactory: func() *MockStorageClient { return &MockStorageClient{ FailCreateContainer: true, } }, errMatcher: Not(BeNil()), resMatcher: BeFalse(), }, } for _, tc := range cases { c := tc t.Run(c.name, func(t *testing.T) { t.Parallel() client := c.storageClientFactory() res, err := client.CreateContainer("fakeContainerName", nil) g := NewGomegaWithT(t) g.Expect(err).To(c.errMatcher) g.Expect(res).To(c.resMatcher) }) } } func TestAzureStorageClient_SaveBlockBlob(t *testing.T) { cases := []struct { name string storageClientFactory func() *MockStorageClient errMatcher types.GomegaMatcher }{ { name: "ShouldPassIfCreated", storageClientFactory: func() *MockStorageClient { return &MockStorageClient{ FailSaveBlockBlob: false, } }, errMatcher: BeNil(), }, { name: "ShouldReturnErrorWhenCreationFails", storageClientFactory: func() *MockStorageClient { return &MockStorageClient{ FailSaveBlockBlob: true, } }, errMatcher: Not(BeNil()), }, } for _, tc := range cases { c := tc t.Run(c.name, func(t *testing.T) { t.Parallel() client := c.storageClientFactory() err := client.SaveBlockBlob("fakeContainerName", "fakeBlobName", []byte("entity"), nil) g := NewGomegaWithT(t) g.Expect(err).To(c.errMatcher) }) } }
package main import ( "unsafe" "fmt" ) func addr_change_by_GC(){ // Go语言中对象的地址可能发生变化,因此指针不能从其它非指针类型的值生成: // 当内存发送变化的时候,相关的指针会同步更新,但是非指针类型的uintptr不会做同步更新。 // //同理CGO中也不能保存Go对象地址。 var x int = 42 var p uintptr = uintptr(unsafe.Pointer(&x)) //runtime.GC() var px *int = (*int)(unsafe.Pointer(p)) fmt.Println(*px, p, px) fmt.Printf("address changed, from %v to %v \n", p, px) fmt.Printf("pointer vars' addressses: %v %v \n", &p, &px) fmt.Printf("original value: %v %v \n", *(*int)(unsafe.Pointer(p)), *px) // 指针类型转换 } func ptr_convert_and_offset() { var x struct { a bool b int16 c []int } /** unsafe.Offsetof 函数的参数必须是一个字段 x.f, 然后返回 f 字段相对于 x 起始地址的偏移量, 包括可能的空洞. */ /** uintptr(unsafe.Pointer(&x)) + unsafe.Offsetof(x.b) 指针的运算 */ // 和 pb := &x.b 等价 pb := (*int16)(unsafe.Pointer(uintptr(unsafe.Pointer(&x)) + unsafe.Offsetof(x.b))) *pb = 42 fmt.Println(x.b) // "42" fmt.Println(uintptr(unsafe.Pointer(&x)) , unsafe.Offsetof(x.b), uintptr(unsafe.Pointer(&(x.b)))) } func main() { addr_change_by_GC() ptr_convert_and_offset() }
// miscellaneous utility functions used for the landing page of the application package cvetool import ( "glsamaker/pkg/models" "glsamaker/pkg/models/users" "html/template" "net/http" ) // renderIndexTemplate renders all templates used for the landing page func renderIndexTemplate(w http.ResponseWriter, user *users.User) { templates := template.Must( template.Must( template.New("Show"). ParseGlob("web/templates/layout/*.tmpl")). ParseGlob("web/templates/index/*.tmpl")) templates.ExecuteTemplate(w, "show.tmpl", createPageData("cvetool", user)) } // renderIndexTemplate renders all templates used for the landing page func renderIndexFullscreenTemplate(w http.ResponseWriter, user *users.User) { templates := template.Must( template.Must( template.New("Show"). ParseGlob("web/templates/layout/*.tmpl")). ParseGlob("web/templates/index/*.tmpl")) templates.ExecuteTemplate(w, "showFullscreen.tmpl", createPageData("cvetool", user)) } // renderIndexTemplate renders all templates used for the landing page func renderNewCVETemplate(w http.ResponseWriter, user *users.User) { templates := template.Must( template.Must( template.New("Show"). ParseGlob("web/templates/layout/*.tmpl")). ParseGlob("web/templates/index/new.tmpl")) templates.ExecuteTemplate(w, "new.tmpl", createPageData("cvetool", user)) } // createPageData creates the data used in the template of the landing page func createPageData(page string, user *users.User) interface{} { return struct { Page string Application *models.GlobalSettings User *users.User CanEdit bool }{ Page: page, Application: models.GetDefaultGlobalSettings(), User: user, CanEdit: user.CanEditCVEs(), } }
package user_model import "testing" func TestParse(t *testing.T) { ParseAuthToken("5BnE2nHyCERFJjM3158EWNnWzrzdkB1E6q8YsSyfo+7wDOMLZnDFd331p06P/mnV") }
package main import ( "fmt" "sync" "time" pb "github.com/gautamrege/gochat/api" ) /**** This is the pb.Handle struct THIS IS FOR REFERENCE ONLY. DO NOT UNCOMMENT type pb.Handle struct { Name string Host string Port int32 } ****/ type Handle struct { pb.Handle Created_at time.Time } // Ensure that handles are added / removed using a mutex! type HandleSync struct { sync.RWMutex HandleMap map[string]Handle } var ME pb.Handle var HANDLES HandleSync // Insert handle if not exists // if existst then update the data func (hs *HandleSync) Insert(h pb.Handle) (err error) { hs.Lock() // TODO-WORKSHOP: This code should insert the handle into the HandleMap hs.HandleMap[h.Name] = Handle{ Created_at: time.Now(), Handle: h, } // fmt.Println(h) hs.Unlock() return nil } // get the user details from the map with given name func (hs *HandleSync) Get(name string) (h pb.Handle, ok bool) { hs.Lock() // TODO-WORKSHOP: This code should fetch the handle from the HandleMap based on the key name // TODO-THINK: Why is this in a Lock() method? handle, ok := hs.HandleMap[name] h = handle.Handle hs.Unlock() return } // delete the user from map func (hs *HandleSync) Delete(name string) { hs.Lock() // TODO-WORKSHOP: This code should remove the handle from the HandleMap based on the key name delete(hs.HandleMap, name) hs.Unlock() fmt.Println("Handle Removed for ", name) } func (h Handle) String() string { return fmt.Sprintf("%s@%s:%d", h.Name, h.Host, h.Port) } func (hs HandleSync) String() (users string) { // TODO-WORKSHOP: This code should print the list of all names of the handles in the map // TODO-THINK: Do we need a Lock here? hs.Lock() for k, _ := range hs.HandleMap { users += fmt.Sprintf("@%s", k) } hs.Unlock() return }
package jwallgame import ( "fmt" "net/http" "bytes" "io/ioutil" "encoding/xml" ) type jwAllGamesCheckerResponseEnvelope struct { XMLName xml.Name Body jwAllGamesCheckerResponseBody } type jwAllGamesCheckerResponseBody struct { XMLName xml.Name GetResponse jwAllGamesCheckerResponse `xml:"FN_SEL_Celebra_RPT_JackpotWinnings_All_Games_CheckerResponse"` } type jwAllGamesCheckerResponse struct { XMLName xml.Name `xml:"FN_SEL_Celebra_RPT_JackpotWinnings_All_Games_CheckerResponse"` Result int `xml:"FN_SEL_Celebra_RPT_JackpotWinnings_All_Games_CheckerResult"` } func header() string { return "<x:Envelope xmlns:x=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\"http://tempuri.org/\">" + "<x:Header/>" + "<x:Body>" + "<tem:FN_SEL_Celebra_RPT_JackpotWinnings_All_Games_Checker>" + " <tem:JackpotDate>%s</tem:JackpotDate>" + " <tem:Provider>%s</tem:Provider>" + " <tem:Terminal>%s</tem:Terminal>" + " <tem:Outlet>%s</tem:Outlet>" + " <tem:ProgressiveName>%s</tem:ProgressiveName>" + " <tem:Payout>%g</tem:Payout>" + " <tem:ClientKey>BsCbcZTDkN5pCNtB35QnMGZ2SBzRpQ</tem:ClientKey>" + "</tem:FN_SEL_Celebra_RPT_JackpotWinnings_All_Games_Checker>" + "</x:Body>" + "</x:Envelope>" } func Check(jackpotOn, provider, terminal, outlet, gameName string, jackpot float32) (bool, error) { q := header() q = fmt.Sprintf(q, jackpotOn, provider, terminal, outlet, gameName, jackpot) client := http.Client{} resp, err := client.Post("http://116.93.80.34/erf_svc/statistics.asmx?WSDL", "text/xml; charset=utf-8", bytes.NewBufferString(q)) if err != nil { return false, err } buf, err := ioutil.ReadAll(resp.Body) if err != nil { return false, err } defer resp.Body.Close() r := jwAllGamesCheckerResponseEnvelope{} err = xml.Unmarshal(buf, &r) if err != nil { return false, err } return r.Body.GetResponse.Result == 0, nil }
package api import ( "bytes" "encoding/json" "fmt" "io" "net/http" "net/http/httptest" "testing" "testing/iotest" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestHTTPClientSanitizeASCIIControlCharactersC0(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { issue := Issue{ Title: "\u001B[31mRed Title\u001B[0m", Body: "1\u0001 2\u0002 3\u0003 4\u0004 5\u0005 6\u0006 7\u0007 8\u0008 9\t A\r\n B\u000b C\u000c D\r\n E\u000e F\u000f", Author: Author{ ID: "1", Name: "10\u0010 11\u0011 12\u0012 13\u0013 14\u0014 15\u0015 16\u0016 17\u0017 18\u0018 19\u0019 1A\u001a 1B\u001b 1C\u001c 1D\u001d 1E\u001e 1F\u001f", Login: "monalisa \\u00\u001b", }, ActiveLockReason: "Escaped \u001B \\u001B \\\u001B \\\\u001B", } responseData, _ := json.Marshal(issue) w.Header().Set("Content-Type", "application/json; charset=utf-8") fmt.Fprint(w, string(responseData)) })) defer ts.Close() client, err := NewHTTPClient(HTTPClientOptions{}) require.NoError(t, err) req, err := http.NewRequest("GET", ts.URL, nil) require.NoError(t, err) res, err := client.Do(req) require.NoError(t, err) body, err := io.ReadAll(res.Body) res.Body.Close() require.NoError(t, err) var issue Issue err = json.Unmarshal(body, &issue) require.NoError(t, err) assert.Equal(t, "^[[31mRed Title^[[0m", issue.Title) assert.Equal(t, "1^A 2^B 3^C 4^D 5^E 6^F 7^G 8^H 9\t A\r\n B^K C^L D\r\n E^N F^O", issue.Body) assert.Equal(t, "10^P 11^Q 12^R 13^S 14^T 15^U 16^V 17^W 18^X 19^Y 1A^Z 1B^[ 1C^\\ 1D^] 1E^^ 1F^_", issue.Author.Name) assert.Equal(t, "monalisa \\u00^[", issue.Author.Login) assert.Equal(t, "Escaped ^[ \\^[ \\^[ \\\\^[", issue.ActiveLockReason) } func TestHTTPClientSanitizeASCIIControlCharactersC1(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { issue := Issue{ Title: "\xC2\x9B[31mRed Title\xC2\x9B[0m", Body: "80\xC2\x80 81\xC2\x81 82\xC2\x82 83\xC2\x83 84\xC2\x84 85\xC2\x85 86\xC2\x86 87\xC2\x87 88\xC2\x88 89\xC2\x89 8A\xC2\x8A 8B\xC2\x8B 8C\xC2\x8C 8D\xC2\x8D 8E\xC2\x8E 8F\xC2\x8F", Author: Author{ ID: "1", Name: "90\xC2\x90 91\xC2\x91 92\xC2\x92 93\xC2\x93 94\xC2\x94 95\xC2\x95 96\xC2\x96 97\xC2\x97 98\xC2\x98 99\xC2\x99 9A\xC2\x9A 9B\xC2\x9B 9C\xC2\x9C 9D\xC2\x9D 9E\xC2\x9E 9F\xC2\x9F", Login: "monalisa\xC2\xA1", }, } responseData, _ := json.Marshal(issue) w.Header().Set("Content-Type", "application/json; charset=utf-8") fmt.Fprint(w, string(responseData)) })) defer ts.Close() client, err := NewHTTPClient(HTTPClientOptions{}) require.NoError(t, err) req, err := http.NewRequest("GET", ts.URL, nil) require.NoError(t, err) res, err := client.Do(req) require.NoError(t, err) body, err := io.ReadAll(res.Body) res.Body.Close() require.NoError(t, err) var issue Issue err = json.Unmarshal(body, &issue) require.NoError(t, err) assert.Equal(t, "^[[31mRed Title^[[0m", issue.Title) assert.Equal(t, "80^@ 81^A 82^B 83^C 84^D 85^E 86^F 87^G 88^H 89^I 8A^J 8B^K 8C^L 8D^M 8E^N 8F^O", issue.Body) assert.Equal(t, "90^P 91^Q 92^R 93^S 94^T 95^U 96^V 97^W 98^X 99^Y 9A^Z 9B^[ 9C^\\ 9D^] 9E^^ 9F^_", issue.Author.Name) assert.Equal(t, "monalisa¡", issue.Author.Login) } func TestSanitizedReadCloser(t *testing.T) { data := []byte(`the quick brown fox\njumped over the lazy dog\t`) rc := sanitizedReadCloser(io.NopCloser(bytes.NewReader(data))) assert.NoError(t, iotest.TestReader(rc, data)) }
package domain import ( "errors" "time" ) // checkExipirationDate validates that the token is not expired. func checkExpirationDate(exp int64) error { now := time.Now().UTC().Unix() if exp < now { return errors.New("error: token is expired") } return nil } // checkWhiteList validates that the token is avaliable in redis. func checkWhiteList(uuid string) error { _, err := client.Get(uuid).Result() if err != nil { return err } return nil } // Verify function returns user_id if the token is valid, // else it will return an empty string with an error. Also it // will return empty string & error if an operation goes wrong. func Verify(tokenStr string) (userID, uuid string, e error) { // 1. Parse the token, and get claims. exp, userID, uuid, err := parseToken(tokenStr) if err != nil { return "", "", err } // 2. Check the expiration date. if err := checkExpirationDate(exp); err != nil { return "", "", ErrInvalidToken } // 3. Check the while list (redis). if err := checkWhiteList(uuid); err != nil { return "", "", ErrInvalidToken } // 4. Return values. return userID, uuid, nil }
/* * @lc app=leetcode id=39 lang=golang * * [39] Combination Sum * * https://leetcode.com/problems/combination-sum/description/ * * algorithms * Medium (49.04%) * Likes: 2089 * Dislikes: 65 * Total Accepted: 354.3K * Total Submissions: 722.4K * Testcase Example: '[2,3,6,7]\n7' * * Given a set of candidate numbers (candidates) (without duplicates) and a * target number (target), find all unique combinations in candidates where the * candidate numbers sums to target. * * The same repeated number may be chosen from candidates unlimited number of * times. * * Note: * * * All numbers (including target) will be positive integers. * The solution set must not contain duplicate combinations. * * * Example 1: * * * Input: candidates = [2,3,6,7], target = 7, * A solution set is: * [ * ⁠ [7], * ⁠ [2,2,3] * ] * * * Example 2: * * * Input: candidates = [2,3,5], target = 8, * A solution set is: * [ * [2,2,2,2], * [2,3,3], * [3,5] * ] * * */ func combi(candidates []int, target int, path []int, ret *[][]int) { // 전달된 후보 슬라이스 길이가 0 이면 리턴한다 if len(candidates) == 0 { return } // target 값이 0 이하이면 리턴한다 if target < 0 { return } // 전달된 후보 값 첫번째를 꺼내서 n := candidates[0] // 첫번째 값의 배수 스텝으로 루프를 수행하는데 target 값 이하일때까지만 수행한다 for i := 0; i <= target; i += n { // i가 0이면 첫번째 요소를 쓰지 않는 패스 이므로 // path 에 추가하지 않는다. if i != 0 { path = append(path, n) } // 첫후보값의 배수가 타겟 값과 일치 했을 때 현재 경로를 // 복사 해 결과 슬라이스에 넣어 준다. if target == i { t := make([]int, len(path)) copy(t, path) *ret = append(*ret, t) } else { // 일치하지 않을 때는 첫번째 후보값을 제외한 후보값 슬라이스와 // 타겟에서 현재 i를 뺀 값, 그리고 현재 까지 경로를 // 가지고 재귀 호출한다. combi(candidates[1:], target-i, path, ret) } } } func combinationSum(candidates []int, target int) [][]int { ret := [][]int{} path := []int{} combi(candidates, target, path, &ret) return ret // 이 알고리즘은 후보값 개수 n 에 루프를 순회 하면서 각 요소가 // 타겟 값 내에서 배수 만큼 루프를 추가로 돈다. // n * (t / ni) 정도의 실행 횟수를 가진다. }