Skip to content

Commit 1fe41a2

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Use repository_id in DORA deployment GET docs (DataDog#3782)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 7dc2331 commit 1fe41a2

3 files changed

Lines changed: 160 additions & 12 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18654,7 +18654,7 @@ components:
1865418654
finished_at: 1693491984000000000
1865518655
git:
1865618656
commit_sha: 66adc9350f2cc9b250b69abddab733dd55e1a588
18657-
repository_url: https://github.com/organization/example-repository
18657+
repository_id: github.com/organization/example-repository
1865818658
service: shopist
1865918659
started_at: 1693491974000000000
1866018660
team: backend
@@ -18685,7 +18685,7 @@ components:
1868518685
format: int64
1868618686
type: integer
1868718687
git:
18688-
$ref: '#/components/schemas/DORAGitInfo'
18688+
$ref: '#/components/schemas/DORAGitInfoResponse'
1868918689
service:
1869018690
description: Service name.
1869118691
example: shopist
@@ -18896,7 +18896,7 @@ components:
1889618896
finished_at: 1693491984000000000
1889718897
git:
1889818898
commit_sha: 66adc9350f2cc9b250b69abddab733dd55e1a588
18899-
repository_url: https://github.com/organization/example-repository
18899+
repository_id: github.com/organization/example-repository
1890018900
service: shopist
1890118901
started_at: 1693491974000000000
1890218902
team: backend
@@ -18911,7 +18911,7 @@ components:
1891118911
finished_at: 1693492084000000000
1891218912
git:
1891318913
commit_sha: 77bdc9350f2cc9b250b69abddab733dd55e1a599
18914-
repository_url: https://github.com/organization/api-service
18914+
repository_id: github.com/organization/api-service
1891518915
service: api-service
1891618916
started_at: 1693492074000000000
1891718917
team: backend
@@ -19085,6 +19085,17 @@ components:
1908519085
- repository_url
1908619086
- commit_sha
1908719087
type: object
19088+
DORAGitInfoResponse:
19089+
description: Git info returned by DORA Metrics events.
19090+
properties:
19091+
commit_sha:
19092+
$ref: '#/components/schemas/GitCommitSHA'
19093+
repository_id:
19094+
$ref: '#/components/schemas/GitRepositoryID'
19095+
required:
19096+
- repository_id
19097+
- commit_sha
19098+
type: object
1908819099
DORAIncidentObject:
1908919100
description: A DORA incident event.
1909019101
example:
@@ -28632,6 +28643,10 @@ components:
2863228643
example: 66adc9350f2cc9b250b69abddab733dd55e1a588
2863328644
pattern: ^[a-fA-F0-9]{40,}$
2863428645
type: string
28646+
GitRepositoryID:
28647+
description: Git Repository ID
28648+
example: github.com/organization/example-repository
28649+
type: string
2863528650
GitRepositoryURL:
2863628651
description: Git Repository URL
2863728652
example: https://github.com/organization/example-repository

api/datadogV2/model_dora_deployment_object_attributes.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ type DORADeploymentObjectAttributes struct {
1818
Env *string `json:"env,omitempty"`
1919
// Unix timestamp when the deployment finished.
2020
FinishedAt int64 `json:"finished_at"`
21-
// Git info for DORA Metrics events.
22-
Git *DORAGitInfo `json:"git,omitempty"`
21+
// Git info returned by DORA Metrics events.
22+
Git *DORAGitInfoResponse `json:"git,omitempty"`
2323
// Service name.
2424
Service string `json:"service"`
2525
// Unix timestamp when the deployment started.
@@ -144,17 +144,17 @@ func (o *DORADeploymentObjectAttributes) SetFinishedAt(v int64) {
144144
}
145145

146146
// GetGit returns the Git field value if set, zero value otherwise.
147-
func (o *DORADeploymentObjectAttributes) GetGit() DORAGitInfo {
147+
func (o *DORADeploymentObjectAttributes) GetGit() DORAGitInfoResponse {
148148
if o == nil || o.Git == nil {
149-
var ret DORAGitInfo
149+
var ret DORAGitInfoResponse
150150
return ret
151151
}
152152
return *o.Git
153153
}
154154

155155
// GetGitOk returns a tuple with the Git field value if set, nil otherwise
156156
// and a boolean to check if the value has been set.
157-
func (o *DORADeploymentObjectAttributes) GetGitOk() (*DORAGitInfo, bool) {
157+
func (o *DORADeploymentObjectAttributes) GetGitOk() (*DORAGitInfoResponse, bool) {
158158
if o == nil || o.Git == nil {
159159
return nil, false
160160
}
@@ -166,8 +166,8 @@ func (o *DORADeploymentObjectAttributes) HasGit() bool {
166166
return o != nil && o.Git != nil
167167
}
168168

169-
// SetGit gets a reference to the given DORAGitInfo and assigns it to the Git field.
170-
func (o *DORADeploymentObjectAttributes) SetGit(v DORAGitInfo) {
169+
// SetGit gets a reference to the given DORAGitInfoResponse and assigns it to the Git field.
170+
func (o *DORADeploymentObjectAttributes) SetGit(v DORAGitInfoResponse) {
171171
o.Git = &v
172172
}
173173

@@ -310,7 +310,7 @@ func (o *DORADeploymentObjectAttributes) UnmarshalJSON(bytes []byte) (err error)
310310
CustomTags datadog.NullableList[string] `json:"custom_tags,omitempty"`
311311
Env *string `json:"env,omitempty"`
312312
FinishedAt *int64 `json:"finished_at"`
313-
Git *DORAGitInfo `json:"git,omitempty"`
313+
Git *DORAGitInfoResponse `json:"git,omitempty"`
314314
Service *string `json:"service"`
315315
StartedAt *int64 `json:"started_at"`
316316
Team *string `json:"team,omitempty"`
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
5+
package datadogV2
6+
7+
import (
8+
"fmt"
9+
10+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
11+
)
12+
13+
// DORAGitInfoResponse Git info returned by DORA Metrics events.
14+
type DORAGitInfoResponse struct {
15+
// Git Commit SHA.
16+
CommitSha string `json:"commit_sha"`
17+
// Git Repository ID
18+
RepositoryId string `json:"repository_id"`
19+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
20+
UnparsedObject map[string]interface{} `json:"-"`
21+
AdditionalProperties map[string]interface{} `json:"-"`
22+
}
23+
24+
// NewDORAGitInfoResponse instantiates a new DORAGitInfoResponse object.
25+
// This constructor will assign default values to properties that have it defined,
26+
// and makes sure properties required by API are set, but the set of arguments
27+
// will change when the set of required properties is changed.
28+
func NewDORAGitInfoResponse(commitSha string, repositoryId string) *DORAGitInfoResponse {
29+
this := DORAGitInfoResponse{}
30+
this.CommitSha = commitSha
31+
this.RepositoryId = repositoryId
32+
return &this
33+
}
34+
35+
// NewDORAGitInfoResponseWithDefaults instantiates a new DORAGitInfoResponse object.
36+
// This constructor will only assign default values to properties that have it defined,
37+
// but it doesn't guarantee that properties required by API are set.
38+
func NewDORAGitInfoResponseWithDefaults() *DORAGitInfoResponse {
39+
this := DORAGitInfoResponse{}
40+
return &this
41+
}
42+
43+
// GetCommitSha returns the CommitSha field value.
44+
func (o *DORAGitInfoResponse) GetCommitSha() string {
45+
if o == nil {
46+
var ret string
47+
return ret
48+
}
49+
return o.CommitSha
50+
}
51+
52+
// GetCommitShaOk returns a tuple with the CommitSha field value
53+
// and a boolean to check if the value has been set.
54+
func (o *DORAGitInfoResponse) GetCommitShaOk() (*string, bool) {
55+
if o == nil {
56+
return nil, false
57+
}
58+
return &o.CommitSha, true
59+
}
60+
61+
// SetCommitSha sets field value.
62+
func (o *DORAGitInfoResponse) SetCommitSha(v string) {
63+
o.CommitSha = v
64+
}
65+
66+
// GetRepositoryId returns the RepositoryId field value.
67+
func (o *DORAGitInfoResponse) GetRepositoryId() string {
68+
if o == nil {
69+
var ret string
70+
return ret
71+
}
72+
return o.RepositoryId
73+
}
74+
75+
// GetRepositoryIdOk returns a tuple with the RepositoryId field value
76+
// and a boolean to check if the value has been set.
77+
func (o *DORAGitInfoResponse) GetRepositoryIdOk() (*string, bool) {
78+
if o == nil {
79+
return nil, false
80+
}
81+
return &o.RepositoryId, true
82+
}
83+
84+
// SetRepositoryId sets field value.
85+
func (o *DORAGitInfoResponse) SetRepositoryId(v string) {
86+
o.RepositoryId = v
87+
}
88+
89+
// MarshalJSON serializes the struct using spec logic.
90+
func (o DORAGitInfoResponse) MarshalJSON() ([]byte, error) {
91+
toSerialize := map[string]interface{}{}
92+
if o.UnparsedObject != nil {
93+
return datadog.Marshal(o.UnparsedObject)
94+
}
95+
toSerialize["commit_sha"] = o.CommitSha
96+
toSerialize["repository_id"] = o.RepositoryId
97+
98+
for key, value := range o.AdditionalProperties {
99+
toSerialize[key] = value
100+
}
101+
return datadog.Marshal(toSerialize)
102+
}
103+
104+
// UnmarshalJSON deserializes the given payload.
105+
func (o *DORAGitInfoResponse) UnmarshalJSON(bytes []byte) (err error) {
106+
all := struct {
107+
CommitSha *string `json:"commit_sha"`
108+
RepositoryId *string `json:"repository_id"`
109+
}{}
110+
if err = datadog.Unmarshal(bytes, &all); err != nil {
111+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
112+
}
113+
if all.CommitSha == nil {
114+
return fmt.Errorf("required field commit_sha missing")
115+
}
116+
if all.RepositoryId == nil {
117+
return fmt.Errorf("required field repository_id missing")
118+
}
119+
additionalProperties := make(map[string]interface{})
120+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
121+
datadog.DeleteKeys(additionalProperties, &[]string{"commit_sha", "repository_id"})
122+
} else {
123+
return err
124+
}
125+
o.CommitSha = *all.CommitSha
126+
o.RepositoryId = *all.RepositoryId
127+
128+
if len(additionalProperties) > 0 {
129+
o.AdditionalProperties = additionalProperties
130+
}
131+
132+
return nil
133+
}

0 commit comments

Comments
 (0)