DNS Providers list returned
This commit is contained in:
parent
5125990c4c
commit
f6fd262618
|
@ -102,7 +102,7 @@ class Certificate(db.Model):
|
||||||
serial = Column(String(128))
|
serial = Column(String(128))
|
||||||
cn = Column(String(128))
|
cn = Column(String(128))
|
||||||
deleted = Column(Boolean, index=True)
|
deleted = Column(Boolean, index=True)
|
||||||
dns_provider = Column(Integer(), nullable=True)
|
dns_provider_id = Column(Integer(), nullable=True)
|
||||||
|
|
||||||
not_before = Column(ArrowType)
|
not_before = Column(ArrowType)
|
||||||
not_after = Column(ArrowType)
|
not_after = Column(ArrowType)
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
from marshmallow import fields
|
from marshmallow import fields
|
||||||
from lemur.common.schema import LemurOutputSchema
|
from lemur.common.schema import LemurOutputSchema
|
||||||
from lemur.authorities.schemas import AuthorityNestedOutputSchema
|
from lemur.authorities.schemas import AuthorityNestedOutputSchema
|
||||||
|
from lemur.dns_providers.schemas import DnsProvidersNestedOutputSchema
|
||||||
|
|
||||||
|
|
||||||
class DefaultOutputSchema(LemurOutputSchema):
|
class DefaultOutputSchema(LemurOutputSchema):
|
||||||
|
@ -18,6 +19,7 @@ class DefaultOutputSchema(LemurOutputSchema):
|
||||||
organization = fields.String()
|
organization = fields.String()
|
||||||
organizational_unit = fields.String()
|
organizational_unit = fields.String()
|
||||||
issuer_plugin = fields.String()
|
issuer_plugin = fields.String()
|
||||||
|
dns_providers = fields.List(fields.Nested(DnsProvidersNestedOutputSchema))
|
||||||
|
|
||||||
|
|
||||||
default_output_schema = DefaultOutputSchema()
|
default_output_schema = DefaultOutputSchema()
|
||||||
|
|
|
@ -9,6 +9,7 @@ from flask_restful import Api
|
||||||
from lemur.common.schema import validate_schema
|
from lemur.common.schema import validate_schema
|
||||||
from lemur.authorities.service import get_by_name
|
from lemur.authorities.service import get_by_name
|
||||||
from lemur.auth.service import AuthenticatedResource
|
from lemur.auth.service import AuthenticatedResource
|
||||||
|
from lemur.dns_providers.service import get_all_dns_providers
|
||||||
|
|
||||||
from lemur.defaults.schemas import default_output_schema
|
from lemur.defaults.schemas import default_output_schema
|
||||||
|
|
||||||
|
@ -50,7 +51,8 @@ class LemurDefaults(AuthenticatedResource):
|
||||||
"state": "CA",
|
"state": "CA",
|
||||||
"location": "Los Gatos",
|
"location": "Los Gatos",
|
||||||
"organization": "Netflix",
|
"organization": "Netflix",
|
||||||
"organizationalUnit": "Operations"
|
"organizationalUnit": "Operations",
|
||||||
|
"dnsProviders": [{"name": "test", ...}, {...}],
|
||||||
}
|
}
|
||||||
|
|
||||||
:reqheader Authorization: OAuth token to authenticate
|
:reqheader Authorization: OAuth token to authenticate
|
||||||
|
@ -59,6 +61,7 @@ class LemurDefaults(AuthenticatedResource):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
default_authority = get_by_name(current_app.config.get('LEMUR_DEFAULT_AUTHORITY'))
|
default_authority = get_by_name(current_app.config.get('LEMUR_DEFAULT_AUTHORITY'))
|
||||||
|
dns_providers = get_all_dns_providers()
|
||||||
|
|
||||||
return dict(
|
return dict(
|
||||||
country=current_app.config.get('LEMUR_DEFAULT_COUNTRY'),
|
country=current_app.config.get('LEMUR_DEFAULT_COUNTRY'),
|
||||||
|
@ -67,7 +70,8 @@ class LemurDefaults(AuthenticatedResource):
|
||||||
organization=current_app.config.get('LEMUR_DEFAULT_ORGANIZATION'),
|
organization=current_app.config.get('LEMUR_DEFAULT_ORGANIZATION'),
|
||||||
organizational_unit=current_app.config.get('LEMUR_DEFAULT_ORGANIZATIONAL_UNIT'),
|
organizational_unit=current_app.config.get('LEMUR_DEFAULT_ORGANIZATIONAL_UNIT'),
|
||||||
issuer_plugin=current_app.config.get('LEMUR_DEFAULT_ISSUER_PLUGIN'),
|
issuer_plugin=current_app.config.get('LEMUR_DEFAULT_ISSUER_PLUGIN'),
|
||||||
authority=default_authority
|
authority=default_authority,
|
||||||
|
dns_providers=dns_providers,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,13 @@ from lemur.database import db
|
||||||
|
|
||||||
|
|
||||||
class DnsProviders(db.Model):
|
class DnsProviders(db.Model):
|
||||||
db.Table('dns_providers',
|
__tablename__ = 'dns_providers'
|
||||||
Column('id', Integer(), nullable=False),
|
id = Column(Integer(), primary_key=True)
|
||||||
Column('name', String(length=256), nullable=True),
|
name = Column(String(length=256), unique=True, nullable=True)
|
||||||
Column('description', String(length=1024), nullable=True),
|
description = Column(String(length=1024), nullable=True)
|
||||||
Column('provider_type', String(length=256), nullable=True),
|
provider_type = Column(String(length=256), nullable=True)
|
||||||
Column('credentials', String(length=256), nullable=True),
|
credentials = Column(String(length=256), nullable=True)
|
||||||
Column('api_endpoint', String(length=256), nullable=True),
|
api_endpoint = Column(String(length=256), nullable=True)
|
||||||
Column('date_created', ArrowType(), server_default=text('now()'), nullable=False),
|
date_created = Column(ArrowType(), server_default=text('now()'), nullable=False)
|
||||||
Column('status', String(length=128), nullable=True),
|
status = Column(String(length=128), nullable=True)
|
||||||
Column('options', JSON),
|
options = Column(JSON)
|
||||||
PrimaryKeyConstraint('id'),
|
|
||||||
UniqueConstraint('name'))
|
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
from lemur.common.fields import ArrowDateTime
|
||||||
|
from lemur.common.schema import LemurOutputSchema
|
||||||
|
|
||||||
|
from marshmallow import fields
|
||||||
|
|
||||||
|
|
||||||
|
class DnsProvidersNestedOutputSchema(LemurOutputSchema):
|
||||||
|
__envelope__ = False
|
||||||
|
id = fields.Integer()
|
||||||
|
name = fields.String()
|
||||||
|
description = fields.String()
|
||||||
|
provider_type = fields.String()
|
||||||
|
credentials = fields.String()
|
||||||
|
api_endpoint = fields.String()
|
||||||
|
date_created = ArrowDateTime()
|
||||||
|
status = fields.String()
|
||||||
|
options = fields.String()
|
||||||
|
|
||||||
|
|
||||||
|
default_output_schema = DnsProvidersNestedOutputSchema()
|
|
@ -7,4 +7,10 @@ def get_all_dns_providers(status="active"):
|
||||||
|
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
return DnsProviders.query.all(status=status)
|
all_dns_providers = DnsProviders.query.all()
|
||||||
|
dns_provider_result = []
|
||||||
|
for provider in all_dns_providers:
|
||||||
|
print(provider)
|
||||||
|
if provider.status == status:
|
||||||
|
dns_provider_result.append(provider.__dict__)
|
||||||
|
return dns_provider_result
|
||||||
|
|
|
@ -231,14 +231,18 @@
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="form-group">
|
<div class="col-sm-10">
|
||||||
<label class="control-label col-sm-2">
|
<!-- two -->
|
||||||
DNS Provider (Only needed for LetsEncrypt or ACME implementations)
|
<div class="form-group">
|
||||||
</label>
|
<label class="control-label col-sm-2">
|
||||||
<div class="col-sm-10">
|
DNS Provider
|
||||||
<select class="form-control" ng-model="certificate.extensions.crlDistributionPoints.includeCrlDp"
|
</label>
|
||||||
ng-options="item for item in ['yes', 'no', 'default']"></select>
|
<div class="col-sm-10">
|
||||||
</div> -->
|
<select class="form-control" ng-model="selected" ng-options="item as item.name for item in dnsProviders"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -243,6 +243,7 @@ angular.module('lemur')
|
||||||
certificate.authority = defaults.authority;
|
certificate.authority = defaults.authority;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
certificate.dns_providers = defaults.dnsProviders;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,8 @@ angular.module('lemur')
|
||||||
|
|
||||||
PluginService.getByType('destination').then(function (plugins) {
|
PluginService.getByType('destination').then(function (plugins) {
|
||||||
$scope.plugins = plugins;
|
$scope.plugins = plugins;
|
||||||
_.each($scope.plugins, function (plugin) {
|
|
||||||
|
|
||||||
|
_.each($scope.plugins, function (plugin) {
|
||||||
if (plugin.slug === $scope.destination.plugin.slug) {
|
if (plugin.slug === $scope.destination.plugin.slug) {
|
||||||
plugin.pluginOptions = $scope.destination.plugin.pluginOptions;
|
plugin.pluginOptions = $scope.destination.plugin.pluginOptions;
|
||||||
$scope.destination.plugin = plugin;
|
$scope.destination.plugin = plugin;
|
||||||
|
|
|
@ -230,6 +230,7 @@ angular.module('lemur')
|
||||||
certificate.authority = defaults.authority;
|
certificate.authority = defaults.authority;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
certificate.dns_providers = defaults.dnsProviders;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue