func parsePushContainerImagePayload()

in internal/plugin/plugin.go [175:197]


func parsePushContainerImagePayload(data json.RawMessage) (*cs.PushImageInput, error) {
	p := struct {
		Service string `json:"service"`
		Image   string `json:"image"`
		Label   string `json:"label"`
	}{}
	if err := json.Unmarshal(data, &p); err != nil {
		return nil, err
	}

	for _, check := range []struct{ what, input string }{
		{"service name", p.Service},
		{"container image", p.Image},
		{"container label", p.Label},
	} {
		if len(check.input) != 0 {
			continue
		}
		return nil, fmt.Errorf("push container image: %s is not specified", check.what)
	}

	return &cs.PushImageInput{Service: p.Service, Image: p.Image, Label: p.Label}, nil
}