@@ -6,6 +6,7 @@ import formatLabelledValues from "../utils/render-labelled-values";
66import {
77 attachCustomDomainToBucket ,
88 configureCustomDomainSettings ,
9+ getCustomDomain ,
910 listCustomDomainsOfBucket ,
1011 removeCustomDomainFromBucket ,
1112 tableFromCustomDomainListResponse ,
@@ -19,6 +20,50 @@ export const r2BucketDomainNamespace = createNamespace({
1920 } ,
2021} ) ;
2122
23+ export const r2BucketDomainGetCommand = createCommand ( {
24+ metadata : {
25+ description : "Get custom domain connected to an R2 bucket" ,
26+ status : "stable" ,
27+ owner : "Product: R2" ,
28+ } ,
29+ positionalArgs : [ "bucket" ] ,
30+ args : {
31+ bucket : {
32+ describe : "The name of the R2 bucket whose custom domain to retrieve" ,
33+ type : "string" ,
34+ demandOption : true ,
35+ } ,
36+ domain : {
37+ describe : "The custom domain to get information for" ,
38+ type : "string" ,
39+ demandOption : true ,
40+ } ,
41+ jurisdiction : {
42+ describe : "The jurisdiction where the bucket exists" ,
43+ alias : "J" ,
44+ requiresArg : true ,
45+ type : "string" ,
46+ } ,
47+ } ,
48+ async handler ( { bucket, domain, jurisdiction } , { config } ) {
49+ const accountId = await requireAuth ( config ) ;
50+
51+ logger . log (
52+ `Retrieving custom domain '${ domain } ' connected to bucket '${ bucket } '...`
53+ ) ;
54+
55+ const domainResponse = await getCustomDomain (
56+ accountId ,
57+ bucket ,
58+ domain ,
59+ jurisdiction
60+ ) ;
61+
62+ const tableOutput = tableFromCustomDomainListResponse ( [ domainResponse ] ) ;
63+ logger . log ( tableOutput . map ( ( x ) => formatLabelledValues ( x ) ) . join ( "\n\n" ) ) ;
64+ } ,
65+ } ) ;
66+
2267export const r2BucketDomainListCommand = createCommand ( {
2368 metadata : {
2469 description : "List custom domains for an R2 bucket" ,
0 commit comments