File: releaseRequests.go

package info (click to toggle)
golang-github-azure-azure-sdk-for-go 68.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 556,256 kB
  • sloc: javascript: 196; sh: 96; makefile: 7
file content (84 lines) | stat: -rw-r--r-- 1,901 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

package config

import (
	"encoding/json"
	"fmt"
	"time"
)

type Track2ReleaseRequests map[string][]Track2Request

type Track2Request struct {
	ReleaseRequestInfo
	PackageFlag string `json:"packageFlag,omitempty"`
}

func (c Track2ReleaseRequests) String() string {
	b, _ := json.Marshal(c)
	return string(b)
}

func (c Track2ReleaseRequests) Add(readme string, info Track2Request) {
	if !c.Contains(readme) {
		c[readme] = make([]Track2Request, 0)
	}
	c[readme] = append(c[readme], info)
}

func (c Track2ReleaseRequests) Contains(readme string) bool {
	_, ok := c[readme]
	return ok
}

type Track1ReleaseRequests map[string]TagForRelease

type TagForRelease map[string][]ReleaseRequestInfo

type ReleaseRequestInfo struct {
	TargetDate  *time.Time `json:"targetDate,omitempty"`
	RequestLink string     `json:"requestLink,omitempty"`
}

func (info ReleaseRequestInfo) HasTargetDate() bool {
	return info.TargetDate != nil
}

func (info ReleaseRequestInfo) String() string {
	m := fmt.Sprintf("Release request '%s'", info.RequestLink)
	if info.HasTargetDate() {
		m = fmt.Sprintf("%s (Target date: %s)", m, *info.TargetDate)
	}
	return m
}

func (c Track1ReleaseRequests) String() string {
	b, _ := json.Marshal(c)
	return string(b)
}

func (c Track1ReleaseRequests) Add(readme, tag string, info ReleaseRequestInfo) {
	if !c.Contains(readme) {
		c[readme] = TagForRelease{}
	}
	c[readme].Add(tag, info)
}

func (c Track1ReleaseRequests) Contains(readme string) bool {
	_, ok := c[readme]
	return ok
}

func (c TagForRelease) Add(tag string, info ReleaseRequestInfo) {
	if !c.Contains(tag) {
		c[tag] = []ReleaseRequestInfo{}
	}
	c[tag] = append(c[tag], info)
}

func (c TagForRelease) Contains(tag string) bool {
	_, ok := c[tag]
	return ok
}