Skip to content

Commit 41e7e0b

Browse files
committed
feat(LicenseManager): add getBinding
1 parent 1f2e728 commit 41e7e0b

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

src/clients/janus/LicenseManager/index.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { RequestTracingConfig, RequestConfig, inflightUrlWithQuery } from '../../../HttpClient'
22
import { JanusClient } from '../JanusClient'
3-
import { OptionsListBindings, APIBindingRes } from './types'
3+
import { OptionsListBindings, APIBindingRes, OptionsGetBinding } from './types'
44

55
const TWO_MINUTES_S = 2 * 60
66

@@ -11,6 +11,7 @@ const routes = {
1111
resourceAccess: (resourceKey: string) => `${BASE_URL}/resources/${encodeURIComponent(resourceKey)}/access`,
1212
topbarData: () => `${BASE_URL}/site/pvt/newtopbar`,
1313
listBindings: (tenant: string) => `${BASE_URL}/binding/site/${encodeURIComponent(tenant)}`,
14+
getBinding: (bindingId: string) => `${BASE_URL}/binding/${encodeURIComponent(bindingId)}`,
1415
}
1516

1617
export class LicenseManager extends JanusClient {
@@ -79,4 +80,21 @@ export class LicenseManager extends JanusClient {
7980
},
8081
})
8182
}
83+
84+
public getBinding = ({ adminUserAuthToken, bindingId }: OptionsGetBinding, config?: RequestConfig) => {
85+
const metric = 'lm-get-binding'
86+
return this.http.get<APIBindingRes[]>(routes.getBinding(bindingId), {
87+
inflightKey: inflightUrlWithQuery,
88+
memoizeable: true,
89+
metric,
90+
headers: {
91+
VtexIdclientAutCookie: adminUserAuthToken,
92+
},
93+
...config,
94+
tracing: {
95+
requestSpanNameSuffix: metric,
96+
...config?.tracing,
97+
},
98+
})
99+
}
82100
}

src/clients/janus/LicenseManager/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ export interface OptionsListBindings {
33
adminUserAuthToken: string
44
}
55

6+
export interface OptionsGetBinding {
7+
adminUserAuthToken: string
8+
bindingId: string
9+
}
10+
611
export interface APIAddress {
712
Host: string
813
IsCanonical: boolean

0 commit comments

Comments
 (0)