def requires(self):
     product_id = portfoliomanagement.GetProductIdByProductName(
         self.portfolio,
         self.product,
         self.account_id,
         self.region,
     )
     return {
         'product': product_id,
     }
예제 #2
0
    def requires(self):
        all_params = {}
        all_params.update(self.manifest_parameters)
        all_params.update(self.launch_parameters)
        all_params.update(self.account_parameters)

        ssm_params = {}

        for param_name, param_details in all_params.items():
            if param_details.get('ssm'):
                if param_details.get('default'):
                    del param_details['default']
                ssm_params[param_name] = tasks.GetSSMParamTask(
                    parameter_name=param_name,
                    name=param_details.get('ssm').get('name'),
                    region=param_details.get('ssm').get(
                        'region', config.get_home_region()))
        self.all_params = all_params

        version_id = portfoliomanagement.GetVersionIdByVersionName(
            self.portfolio,
            self.product,
            self.version,
            self.account_id,
            self.region,
        )
        product_id = portfoliomanagement.GetProductIdByProductName(
            self.portfolio,
            self.product,
            self.account_id,
            self.region,
        )

        return {
            'ssm_params':
            ssm_params,
            'version':
            version_id,
            'product':
            product_id,
            'provisioning_artifact_parameters':
            ProvisioningArtifactParametersTask(
                self.portfolio,
                self.product,
                self.version,
                self.account_id,
                self.region,
            ),
        }
    def requires(self):
        all_params = {}
        all_params.update(self.manifest_parameters)
        all_params.update(self.launch_parameters)
        all_params.update(self.account_parameters)

        ssm_params = {}

        for param_name, param_details in all_params.items():
            if param_details.get('ssm'):
                if param_details.get('default'):
                    del param_details['default']
                ssm_params[param_name] = tasks.GetSSMParamTask(
                    parameter_name=param_name,
                    name=param_details.get('ssm').get('name'),
                    region=param_details.get('ssm').get(
                        'region', config.get_home_region()))
        self.all_params = all_params

        dependencies = []
        version_id = portfoliomanagement.GetVersionIdByVersionName(
            self.portfolio,
            self.product,
            self.version,
            self.account_id,
            self.region,
        )
        product_id = portfoliomanagement.GetProductIdByProductName(
            self.portfolio,
            self.product,
            self.account_id,
            self.region,
        )
        for r in self.dependencies:
            if r.get('status') is not None:
                if r.get('status') == constants.TERMINATED:
                    raise Exception("Unsupported")
                new_r = r.get_wrapped()
                del new_r['status']
                dependencies.append(self.__class__(**new_r))
            else:
                dependencies.append(self.__class__(**r))

        return {
            'dependencies':
            dependencies,
            'ssm_params':
            ssm_params,
            'version':
            version_id,
            'product':
            product_id,
            'provisioning_artifact_parameters':
            ProvisioningArtifactParametersTask(
                self.portfolio,
                self.product,
                self.version,
                self.account_id,
                self.region,
            ),
            'pre_actions': [
                portfoliomanagement.ProvisionActionTask(**p)
                for p in self.pre_actions
            ],
        }