-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API documentation #650
Comments
Largely there isn't a ton of documentation since we try to keep troposphere a one to one copy of the cloudformation templating language, so you can usually just use that to describe what fields/attributes various resources/properties have. What kind of documentation would you like to see though? |
Auto-generated documentation of methods and classes would be nice. Sphinx is a good tool for this. |
Yeah - the classes themselves are pretty bare of docs, unfortunately. It'd just be signatures. that said I know @markpeek is working occasionally on integrating the Cloudformation schema that comes directly from AWS, and that has links to the actual cloudformation docs for each resource, so maybe we could do something cool with that at some point. Anyway, thanks for the clarification. |
I recently was thinking about this problem with Troposphere, and saw that this issue was opened a few years ago. It's still an existing problem, and I thought I'd add some thoughts here in case others wanted to contribute. Some initial Sphinx documentation has been slowly added since this issue discussion ended, with #1311 and #1314, but Classes are pretty much just as-is (source code). I would love to help with this, actually, but may need some help. I'm thinking something like the following could be used to automate and expand the documentation with Sphinx and the CFN resource spec documentation links: To StartSome priority items:
Furthering Automated API Documentation Ideas
Example
It would just be a matter of flipping
A proof-of-concept for potential docstring format in a class, using ./troposphere/ec2.py...
...
class CustomerGateway(AWSObject):
"""Specifies a customer gateway.
Attributes:
BgpAsn (integer): For devices that support BGP, the customer gateway's BGP ASN.
IpAddress (basestring): The Internet-routable IP address for the customer gateway's outside interface. The address must be static.
Tags (list(troposphere.Tags), optional): One or more tags for the customer gateway.
Type (basestring): The type of VPN connection that this customer gateway supports (ipsec.1).
"""
resource_type = "AWS::EC2::CustomerGateway"
props = {
'BgpAsn': (integer, True),
'IpAddress': (basestring, True),
'Tags': ((Tags, list), False),
'Type': (basestring, True),
}
class DHCPOptions(AWSObject):
"""Specifies a set of DHCP options for your VPC.
You must specify at least one of the following properties: DomainNameServers, NetbiosNameServers, NtpServers. If you specify NetbiosNameServers, you must specify NetbiosNodeType.
Attributes:
DomainName (basestring, optional): This value is used to complete unqualified DNS hostnames. If you're using AmazonProvidedDNS in us-east-1, specify ec2.internal. If you're using AmazonProvidedDNS in another Region, specify region.compute.internal (for example, ap-northeast-1.compute.internal). Otherwise, specify a domain name (for example, MyCompany.com).
DomainNameServers (list, optional): The IPv4 addresses of up to four domain name servers, or AmazonProvidedDNS. The default DHCP option set specifies AmazonProvidedDNS. If specifying more than one domain name server, specify the IP addresses in a single parameter, separated by commas. To have your instance to receive a custom DNS hostname as specified in DomainName, you must set this to a custom DNS server.
NetbiosNameServers (list, optional): The IPv4 addresses of up to four NetBIOS name servers.
NetbiosNodeType (integer, optional): The NetBIOS node type (1, 2, 4, or 8). We recommend that you specify 2 (broadcast and multicast are not currently supported).
NtpServers (list, optional): The IPv4 addresses of up to four Network Time Protocol (NTP) servers.
Tags (list(troposphere.Tags), optional): Any tags assigned to the DHCP options set.
"""
resource_type = "AWS::EC2::DHCPOptions"
props = {
'DomainName': (basestring, False),
'DomainNameServers': (list, False),
'NetbiosNameServers': (list, False),
'NetbiosNodeType': (integer, False),
'NtpServers': (list, False),
'Tags': ((Tags, list), False),
}
...
... This renders well in readthedocs when using the I'm wondering whether @markpeek, @lowcloudnine, and/or others could provide their input? And if I could be of help in the process? I've only begun poking around with Sphinx and its use here, and I wanted to document my thoughts in this issue while it's on my mind. |
@lsh-0 thank you for letting me know about the docs. I just pushed some changes so "latest" is up to date and "stable" docs should build upon the next release. |
Is there any documentation outside the source code? Read the docs doesn't have any useful information.
The text was updated successfully, but these errors were encountered: