param s returns export class SecretName { readonly project : string ; readonly name : string ; readonly version : string ; constructor ( s ) { s = ( s || '' ) . trim ( ) ; if ( ! s ) { throw new Error ( `Missing secret name` ) ; } const refParts = s . split ( '/' ) ; switch ( refParts . length ) { case 6 : { this . project = refParts [ 1 ] ; this . name = refParts [ 3 ] ; this . version = refParts [ 5 ] ; break ; } case 4 : { this . project = refParts [ 1 ] ; this . name = refParts [ 3 ] ; this . version = 'latest' ; break ; } case 3 : { this . project = refParts [ 0 ] ; this . name = refParts [ 1 ] ; this . version = refParts [ 2 ] ; break ; } case 2 : { this . project = refParts [ 0 ] ; this . name = refParts [ 1 ] ; this . version = 'latest' ; break ; } default : { throw new TypeError ( `Failed to parse secret reference "${ s }": unknown format. Secrets ` + `should be of the format "projects/p/secrets/s/versions/v".` ) ; } } } returns public selfLink ( ) { return `projects/${ this . project }/secrets/${ this . name }/versions/${ this . version }` ; } }