{"action":"created","comment":{"url":"https://api.github.com/repos/byu-oit/handel/pulls/comments/133822469","pull_request_review_id":57048259,"id":133822469,"diff_hunk":"@@ -0,0 +1,141 @@\n+/*\n+ * Copyright 2017 Brigham Young University\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ *\n+ */\n+const winston = require('winston');\n+const DeployContext = require('../../datatypes/deploy-context');\n+const accountConfig = require('../../common/account-config')().getAccountConfig();\n+const cloudFormationCalls = require('../../aws/cloudformation-calls');\n+const deployPhaseCommon = require('../../common/deploy-phase-common');\n+const deletePhasesCommon = require('../../common/delete-phases-common');\n+const preDeployPhaseCommon = require('../../common/pre-deploy-phase-common');\n+const bindPhaseCommon = require('../../common/bind-phase-common');\n+const handlebarsUtils = require('../../common/handlebars-utils');\n+const route53 = require('../../aws/route53-calls');\n+\n+const SERVICE_NAME = \"Route53\";\n+\n+function getDeployContext(serviceContext, cfStack) {\n+    let name = cloudFormationCalls.getOutput('ZoneName', cfStack);\n+    let id = cloudFormationCalls.getOutput('ZoneId', cfStack);\n+    let nameServers = cloudFormationCalls.getOutput('ZoneNameServers', cfStack);\n+\n+    let deployContext = new DeployContext(serviceContext);\n+\n+    //Env variables to inject into consuming services\n+    let zoneNameEnv = deployPhaseCommon.getInjectedEnvVarName(serviceContext, 'ZONE_NAME');\n+    deployContext.environmentVariables[zoneNameEnv] = name;\n+    let zoneIdEnv = deployPhaseCommon.getInjectedEnvVarName(serviceContext, \"ZONE_ID\");\n+    deployContext.environmentVariables[zoneIdEnv] = id;\n+    let zoneNameServersEnv = deployPhaseCommon.getInjectedEnvVarName(serviceContext, \"ZONE_NAME_SERVERS\");\n+    deployContext.environmentVariables[zoneNameServersEnv] = nameServers;\n+\n+    return deployContext;\n+}\n+\n+\n+function getCompiledRoute53Template(ownServiceContext) {\n+    let serviceParams = ownServiceContext.params;\n+\n+    let handlebarsParams = {\n+        name: serviceParams.name,\n+        tags: deployPhaseCommon.getTags(ownServiceContext)\n+    };\n+\n+    if (serviceParams.private) {\n+        handlebarsParams.vpcs = [{\n+            id: accountConfig.vpc,\n+            region: accountConfig.region\n+        }];\n+    }\n+\n+    return handlebarsUtils.compileTemplate(`${__dirname}/route53zone-template.yml`, handlebarsParams)\n+}\n+\n+/**\n+ * Service Deployer Contract Methods\n+ * See https://github.com/byu-oit-appdev/handel/wiki/Creating-a-New-Service-Deployer#service-deployer-contract\n+ *   for contract method documentation\n+ */\n+\n+exports.check = function (serviceContext) {\n+    let errors = [];\n+\n+    let params = serviceContext.params;\n+\n+    if (!params.name) {\n+        errors.push(`${SERVICE_NAME} - 'name' parameter must be specified`);\n+    } else if (!route53.isValidHostname(params.name)) {\n+        errors.push(`${SERVICE_NAME} - 'name' parameter must be a valid hostname`);\n+    }\n+\n+    if (params.private && typeof params.private !== 'boolean') {\n+        errors.push(`${SERVICE_NAME} - 'private' parameter must be 'true' or 'false'`);\n+    }\n+\n+    return errors;\n+}\n+\n+exports.preDeploy = function (serviceContext) {\n+    return preDeployPhaseCommon.preDeployNotRequired(serviceContext, SERVICE_NAME);\n+}\n+\n+exports.bind = function (ownServiceContext, ownPreDeployContext, dependentOfServiceContext, dependentOfPreDeployContext) {\n+    return bindPhaseCommon.bindNotRequired(ownServiceContext, dependentOfServiceContext, SERVICE_NAME);\n+}\n+\n+exports.deploy = function (ownServiceContext, ownPreDeployContext, dependenciesDeployContexts) {\n+    let stackName = deployPhaseCommon.getResourceName(ownServiceContext);\n+    winston.info(`${SERVICE_NAME} - Deploying Route53 Zone ${stackName}`);\n+\n+    return getCompiledRoute53Template(ownServiceContext)\n+        .then(compiledTemplate => {\n+            let stackTags = deployPhaseCommon.getTags(ownServiceContext);\n+            return deployPhaseCommon.deployCloudFormationStack(stackName, compiledTemplate, [], true, SERVICE_NAME, stackTags);\n+        })\n+        .then(createdOrUpdatedStack => {\n+            winston.info(`${SERVICE_NAME} - Finished deploying S3 bucket ${stackName}`);\n+            return getDeployContext(ownServiceContext, createdOrUpdatedStack);\n+        });\n+}\n+\n+exports.consumeEvents = function (ownServiceContext, ownDeployContext, producerServiceContext, producerDeployContext) {\n+    return Promise.reject(new Error(`The ${SERVICE_NAME} service doesn't consume events from other services`));\n+}\n+\n+exports.produceEvents = function (ownServiceContext, ownDeployContext, consumerServiceContext, consumerDeployContext) {\n+    return Promise.reject(new Error(`The ${SERVICE_NAME} service doesn't currently produce events for other services`));\n+}\n+\n+exports.unPreDeploy = function (ownServiceContext) {\n+    return deletePhasesCommon.unPreDeployNotRequired(ownServiceContext, SERVICE_NAME);\n+}\n+\n+exports.unBind = function (ownServiceContext) {\n+    return deletePhasesCommon.unBindNotRequired(ownServiceContext, SERVICE_NAME);\n+}\n+\n+exports.unDeploy = function (ownServiceContext) {\n+    return deletePhasesCommon.unDeployService(ownServiceContext, SERVICE_NAME);\n+}\n+\n+exports.producedEventsSupportedServices = []; //TODO - No events supported yet, but we will support some like Lambda\n+\n+exports.producedDeployOutputTypes = [\n+    'environmentVariables',\n+    'policies'","path":"lib/services/route53zone/index.js","position":138,"original_position":138,"commit_id":"db970de728c82fd7af801f5f96e25365a407ee2f","original_commit_id":"db970de728c82fd7af801f5f96e25365a407ee2f","user":{"login":"ThatJoeMoore","id":455981,"avatar_url":"https://avatars0.githubusercontent.com/u/455981?v=4","gravatar_id":"","url":"https://api.github.com/users/ThatJoeMoore","html_url":"https://github.com/ThatJoeMoore","followers_url":"https://api.github.com/users/ThatJoeMoore/followers","following_url":"https://api.github.com/users/ThatJoeMoore/following{/other_user}","gists_url":"https://api.github.com/users/ThatJoeMoore/gists{/gist_id}","starred_url":"https://api.github.com/users/ThatJoeMoore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThatJoeMoore/subscriptions","organizations_url":"https://api.github.com/users/ThatJoeMoore/orgs","repos_url":"https://api.github.com/users/ThatJoeMoore/repos","events_url":"https://api.github.com/users/ThatJoeMoore/events{/privacy}","received_events_url":"https://api.github.com/users/ThatJoeMoore/received_events","type":"User","site_admin":false},"body":"Yay copypasta!","created_at":"2017-08-17T20:38:10Z","updated_at":"2017-08-17T20:38:10Z","html_url":"https://github.com/byu-oit/handel/pull/244#discussion_r133822469","pull_request_url":"https://api.github.com/repos/byu-oit/handel/pulls/244","_links":{"self":{"href":"https://api.github.com/repos/byu-oit/handel/pulls/comments/133822469"},"html":{"href":"https://github.com/byu-oit/handel/pull/244#discussion_r133822469"},"pull_request":{"href":"https://api.github.com/repos/byu-oit/handel/pulls/244"}}},"pull_request":{"url":"https://api.github.com/repos/byu-oit/handel/pulls/244","id":136139898,"html_url":"https://github.com/byu-oit/handel/pull/244","diff_url":"https://github.com/byu-oit/handel/pull/244.diff","patch_url":"https://github.com/byu-oit/handel/pull/244.patch","issue_url":"https://api.github.com/repos/byu-oit/handel/issues/244","number":244,"state":"open","locked":false,"title":"Route53 Support","user":{"login":"ThatJoeMoore","id":455981,"avatar_url":"https://avatars0.githubusercontent.com/u/455981?v=4","gravatar_id":"","url":"https://api.github.com/users/ThatJoeMoore","html_url":"https://github.com/ThatJoeMoore","followers_url":"https://api.github.com/users/ThatJoeMoore/followers","following_url":"https://api.github.com/users/ThatJoeMoore/following{/other_user}","gists_url":"https://api.github.com/users/ThatJoeMoore/gists{/gist_id}","starred_url":"https://api.github.com/users/ThatJoeMoore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThatJoeMoore/subscriptions","organizations_url":"https://api.github.com/users/ThatJoeMoore/orgs","repos_url":"https://api.github.com/users/ThatJoeMoore/repos","events_url":"https://api.github.com/users/ThatJoeMoore/events{/privacy}","received_events_url":"https://api.github.com/users/ThatJoeMoore/received_events","type":"User","site_admin":false},"body":"Adds support for a `route53zone` service and for configuring DNS records for Beanstalk and ECS.\r\n\r\nResolves #237 .\r\n\r\nThe only outstanding thing (which should probably be a separate PR) is adding the ability for services to give messages to the user (separate from the normal logging), so that things like the manual steps for `route53zone` can be explained.","created_at":"2017-08-16T22:53:26Z","updated_at":"2017-08-17T20:38:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bb895718f58cd6476cd3f87e8a8902b64f4b7662","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/byu-oit/handel/pulls/244/commits","review_comments_url":"https://api.github.com/repos/byu-oit/handel/pulls/244/comments","review_comment_url":"https://api.github.com/repos/byu-oit/handel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/byu-oit/handel/issues/244/comments","statuses_url":"https://api.github.com/repos/byu-oit/handel/statuses/db970de728c82fd7af801f5f96e25365a407ee2f","head":{"label":"ThatJoeMoore:route53","ref":"route53","sha":"db970de728c82fd7af801f5f96e25365a407ee2f","user":{"login":"ThatJoeMoore","id":455981,"avatar_url":"https://avatars0.githubusercontent.com/u/455981?v=4","gravatar_id":"","url":"https://api.github.com/users/ThatJoeMoore","html_url":"https://github.com/ThatJoeMoore","followers_url":"https://api.github.com/users/ThatJoeMoore/followers","following_url":"https://api.github.com/users/ThatJoeMoore/following{/other_user}","gists_url":"https://api.github.com/users/ThatJoeMoore/gists{/gist_id}","starred_url":"https://api.github.com/users/ThatJoeMoore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThatJoeMoore/subscriptions","organizations_url":"https://api.github.com/users/ThatJoeMoore/orgs","repos_url":"https://api.github.com/users/ThatJoeMoore/repos","events_url":"https://api.github.com/users/ThatJoeMoore/events{/privacy}","received_events_url":"https://api.github.com/users/ThatJoeMoore/received_events","type":"User","site_admin":false},"repo":{"id":100394600,"name":"handel","full_name":"ThatJoeMoore/handel","owner":{"login":"ThatJoeMoore","id":455981,"avatar_url":"https://avatars0.githubusercontent.com/u/455981?v=4","gravatar_id":"","url":"https://api.github.com/users/ThatJoeMoore","html_url":"https://github.com/ThatJoeMoore","followers_url":"https://api.github.com/users/ThatJoeMoore/followers","following_url":"https://api.github.com/users/ThatJoeMoore/following{/other_user}","gists_url":"https://api.github.com/users/ThatJoeMoore/gists{/gist_id}","starred_url":"https://api.github.com/users/ThatJoeMoore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThatJoeMoore/subscriptions","organizations_url":"https://api.github.com/users/ThatJoeMoore/orgs","repos_url":"https://api.github.com/users/ThatJoeMoore/repos","events_url":"https://api.github.com/users/ThatJoeMoore/events{/privacy}","received_events_url":"https://api.github.com/users/ThatJoeMoore/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ThatJoeMoore/handel","description":"Orchestrates your AWS deployments so you don't have to.","fork":true,"url":"https://api.github.com/repos/ThatJoeMoore/handel","forks_url":"https://api.github.com/repos/ThatJoeMoore/handel/forks","keys_url":"https://api.github.com/repos/ThatJoeMoore/handel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ThatJoeMoore/handel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ThatJoeMoore/handel/teams","hooks_url":"https://api.github.com/repos/ThatJoeMoore/handel/hooks","issue_events_url":"https://api.github.com/repos/ThatJoeMoore/handel/issues/events{/number}","events_url":"https://api.github.com/repos/ThatJoeMoore/handel/events","assignees_url":"https://api.github.com/repos/ThatJoeMoore/handel/assignees{/user}","branches_url":"https://api.github.com/repos/ThatJoeMoore/handel/branches{/branch}","tags_url":"https://api.github.com/repos/ThatJoeMoore/handel/tags","blobs_url":"https://api.github.com/repos/ThatJoeMoore/handel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ThatJoeMoore/handel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ThatJoeMoore/handel/git/refs{/sha}","trees_url":"https://api.github.com/repos/ThatJoeMoore/handel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ThatJoeMoore/handel/statuses/{sha}","languages_url":"https://api.github.com/repos/ThatJoeMoore/handel/languages","stargazers_url":"https://api.github.com/repos/ThatJoeMoore/handel/stargazers","contributors_url":"https://api.github.com/repos/ThatJoeMoore/handel/contributors","subscribers_url":"https://api.github.com/repos/ThatJoeMoore/handel/subscribers","subscription_url":"https://api.github.com/repos/ThatJoeMoore/handel/subscription","commits_url":"https://api.github.com/repos/ThatJoeMoore/handel/commits{/sha}","git_commits_url":"https://api.github.com/repos/ThatJoeMoore/handel/git/commits{/sha}","comments_url":"https://api.github.com/repos/ThatJoeMoore/handel/comments{/number}","issue_comment_url":"https://api.github.com/repos/ThatJoeMoore/handel/issues/comments{/number}","contents_url":"https://api.github.com/repos/ThatJoeMoore/handel/contents/{+path}","compare_url":"https://api.github.com/repos/ThatJoeMoore/handel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ThatJoeMoore/handel/merges","archive_url":"https://api.github.com/repos/ThatJoeMoore/handel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ThatJoeMoore/handel/downloads","issues_url":"https://api.github.com/repos/ThatJoeMoore/handel/issues{/number}","pulls_url":"https://api.github.com/repos/ThatJoeMoore/handel/pulls{/number}","milestones_url":"https://api.github.com/repos/ThatJoeMoore/handel/milestones{/number}","notifications_url":"https://api.github.com/repos/ThatJoeMoore/handel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ThatJoeMoore/handel/labels{/name}","releases_url":"https://api.github.com/repos/ThatJoeMoore/handel/releases{/id}","deployments_url":"https://api.github.com/repos/ThatJoeMoore/handel/deployments","created_at":"2017-08-15T15:59:54Z","updated_at":"2017-08-15T15:59:56Z","pushed_at":"2017-08-16T22:58:26Z","git_url":"git://github.com/ThatJoeMoore/handel.git","ssh_url":"git@github.com:ThatJoeMoore/handel.git","clone_url":"https://github.com/ThatJoeMoore/handel.git","svn_url":"https://github.com/ThatJoeMoore/handel","homepage":"","size":988,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"byu-oit:master","ref":"master","sha":"c4d6af15146a63c19879340a253b36b5ce6cb280","user":{"login":"byu-oit","id":15636349,"avatar_url":"https://avatars2.githubusercontent.com/u/15636349?v=4","gravatar_id":"","url":"https://api.github.com/users/byu-oit","html_url":"https://github.com/byu-oit","followers_url":"https://api.github.com/users/byu-oit/followers","following_url":"https://api.github.com/users/byu-oit/following{/other_user}","gists_url":"https://api.github.com/users/byu-oit/gists{/gist_id}","starred_url":"https://api.github.com/users/byu-oit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/byu-oit/subscriptions","organizations_url":"https://api.github.com/users/byu-oit/orgs","repos_url":"https://api.github.com/users/byu-oit/repos","events_url":"https://api.github.com/users/byu-oit/events{/privacy}","received_events_url":"https://api.github.com/users/byu-oit/received_events","type":"Organization","site_admin":false},"repo":{"id":81119606,"name":"handel","full_name":"byu-oit/handel","owner":{"login":"byu-oit","id":15636349,"avatar_url":"https://avatars2.githubusercontent.com/u/15636349?v=4","gravatar_id":"","url":"https://api.github.com/users/byu-oit","html_url":"https://github.com/byu-oit","followers_url":"https://api.github.com/users/byu-oit/followers","following_url":"https://api.github.com/users/byu-oit/following{/other_user}","gists_url":"https://api.github.com/users/byu-oit/gists{/gist_id}","starred_url":"https://api.github.com/users/byu-oit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/byu-oit/subscriptions","organizations_url":"https://api.github.com/users/byu-oit/orgs","repos_url":"https://api.github.com/users/byu-oit/repos","events_url":"https://api.github.com/users/byu-oit/events{/privacy}","received_events_url":"https://api.github.com/users/byu-oit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/byu-oit/handel","description":"Orchestrates your AWS deployments so you don't have to.","fork":false,"url":"https://api.github.com/repos/byu-oit/handel","forks_url":"https://api.github.com/repos/byu-oit/handel/forks","keys_url":"https://api.github.com/repos/byu-oit/handel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/byu-oit/handel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/byu-oit/handel/teams","hooks_url":"https://api.github.com/repos/byu-oit/handel/hooks","issue_events_url":"https://api.github.com/repos/byu-oit/handel/issues/events{/number}","events_url":"https://api.github.com/repos/byu-oit/handel/events","assignees_url":"https://api.github.com/repos/byu-oit/handel/assignees{/user}","branches_url":"https://api.github.com/repos/byu-oit/handel/branches{/branch}","tags_url":"https://api.github.com/repos/byu-oit/handel/tags","blobs_url":"https://api.github.com/repos/byu-oit/handel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/byu-oit/handel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/byu-oit/handel/git/refs{/sha}","trees_url":"https://api.github.com/repos/byu-oit/handel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/byu-oit/handel/statuses/{sha}","languages_url":"https://api.github.com/repos/byu-oit/handel/languages","stargazers_url":"https://api.github.com/repos/byu-oit/handel/stargazers","contributors_url":"https://api.github.com/repos/byu-oit/handel/contributors","subscribers_url":"https://api.github.com/repos/byu-oit/handel/subscribers","subscription_url":"https://api.github.com/repos/byu-oit/handel/subscription","commits_url":"https://api.github.com/repos/byu-oit/handel/commits{/sha}","git_commits_url":"https://api.github.com/repos/byu-oit/handel/git/commits{/sha}","comments_url":"https://api.github.com/repos/byu-oit/handel/comments{/number}","issue_comment_url":"https://api.github.com/repos/byu-oit/handel/issues/comments{/number}","contents_url":"https://api.github.com/repos/byu-oit/handel/contents/{+path}","compare_url":"https://api.github.com/repos/byu-oit/handel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/byu-oit/handel/merges","archive_url":"https://api.github.com/repos/byu-oit/handel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/byu-oit/handel/downloads","issues_url":"https://api.github.com/repos/byu-oit/handel/issues{/number}","pulls_url":"https://api.github.com/repos/byu-oit/handel/pulls{/number}","milestones_url":"https://api.github.com/repos/byu-oit/handel/milestones{/number}","notifications_url":"https://api.github.com/repos/byu-oit/handel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/byu-oit/handel/labels{/name}","releases_url":"https://api.github.com/repos/byu-oit/handel/releases{/id}","deployments_url":"https://api.github.com/repos/byu-oit/handel/deployments","created_at":"2017-02-06T18:46:42Z","updated_at":"2017-08-17T03:20:52Z","pushed_at":"2017-08-17T20:31:27Z","git_url":"git://github.com/byu-oit/handel.git","ssh_url":"git@github.com:byu-oit/handel.git","clone_url":"https://github.com/byu-oit/handel.git","svn_url":"https://github.com/byu-oit/handel","homepage":"","size":980,"stargazers_count":7,"watchers_count":7,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":37,"forks":2,"open_issues":37,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/byu-oit/handel/pulls/244"},"html":{"href":"https://github.com/byu-oit/handel/pull/244"},"issue":{"href":"https://api.github.com/repos/byu-oit/handel/issues/244"},"comments":{"href":"https://api.github.com/repos/byu-oit/handel/issues/244/comments"},"review_comments":{"href":"https://api.github.com/repos/byu-oit/handel/pulls/244/comments"},"review_comment":{"href":"https://api.github.com/repos/byu-oit/handel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/byu-oit/handel/pulls/244/commits"},"statuses":{"href":"https://api.github.com/repos/byu-oit/handel/statuses/db970de728c82fd7af801f5f96e25365a407ee2f"}}}}
{"actor":{"display_login":"ThatJoeMoore"}}