[Groonga-commit] groonga/gcs [master] Resolve arn to hostname by gcs-describe-domain command

Zurück zum Archiv-Index

YUKI Hiroshi null+****@clear*****
Tue Dec 4 14:39:10 JST 2012


YUKI Hiroshi	2012-12-04 14:39:10 +0900 (Tue, 04 Dec 2012)

  New Revision: 152383bf67d0f3dddf4e0553442d6a2f11c54138
  https://github.com/groonga/gcs/commit/152383bf67d0f3dddf4e0553442d6a2f11c54138

  Log:
    Resolve arn to hostname by gcs-describe-domain command

  Modified files:
    bin/gcs-describe-domain

  Modified: bin/gcs-describe-domain (+14 -2)
===================================================================
--- bin/gcs-describe-domain    2012-12-04 13:38:56 +0900 (10f7554)
+++ bin/gcs-describe-domain    2012-12-04 14:39:10 +0900 (3875561)
@@ -16,14 +16,26 @@ commandLine
 
 var client = new Client(commandLine);
 
+
+function arnToEndpoint(arn, prefix) {
+  var match = arn.test(/^arn:aws:cs:[^:]+:([^:]+):(?:doc|search)/(.+)$/);
+  if (!match)
+    client.raiseFatalError('invalid arn: ' + arn);
+
+  var name = match[2];
+  var id = match[1];
+  var hostAndPort = client.host + ':' + client.port;
+  return prefix + '-' + name + '-' + id + '.' + hostAndPort;
+}
+
 function reportStatus(domain, indexFields, defaultSearchField) {
   console.log('=== Domain Summary ===');
   console.log('Domain Name: %s',
               domain.DomainName);
   console.log('Document Service endpoint: %s',
-              domain.DocService.Endpoint);
+              arnToEndpoint(domain.DocService.Arn, 'doc'));
   console.log('Search Service endpoint: %s',
-              domain.SearchService.Endpoint);
+              arnToEndpoint(domain.SearchService.Arn, 'search'));
   console.log('SearchInstanceType: %s',
               null);
   console.log('SearchPartitionCount: %s',
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index