Allow optionally fetching lease data from S3#8
Conversation
bare_metal_billing/main.py
Outdated
|
|
||
| bm_usage_file = args.bm_usage_file or s3_bucket.fetch_s3( | ||
| ... | ||
| ) # TODO: Confirm S3 path |
There was a problem hiding this comment.
Since lease info is uploaded daily. I'll fetch the lease info from the last day of the month.
577c932 to
d48d6e3
Compare
bare_metal_billing/config.py
Outdated
| # S3 Configuration | ||
| S3_ENDPOINT_URL = os.getenv("S3_ENDPOINT_URL", "https://s3.us-east-005.backblazeb2.com") | ||
| S3_KEY_ID = os.getenv("S3_KEY_ID") | ||
| S3_APP_KEY = os.getenv("S3_APP_KEY") |
There was a problem hiding this comment.
you'll need 2 sets of credentials later when you access the bucket to upload the generated invoice to, but that's for later.
There was a problem hiding this comment.
I'd rather change the environment variable names now to not be generic by adding to them either USAGE or LEASE since renaming environment variables is a breaking change.
bare_metal_billing/s3_bucket.py
Outdated
|
|
||
|
|
||
| @functools.lru_cache | ||
| def get_lease_bucket(bucket_name: str): |
There was a problem hiding this comment.
shouldn't this just be get_bucket?
bare_metal_billing/config.py
Outdated
| # S3 Configuration | ||
| S3_ENDPOINT_URL = os.getenv("S3_ENDPOINT_URL", "https://s3.us-east-005.backblazeb2.com") | ||
| S3_KEY_ID = os.getenv("S3_KEY_ID") | ||
| S3_APP_KEY = os.getenv("S3_APP_KEY") |
There was a problem hiding this comment.
I'd rather change the environment variable names now to not be generic by adding to them either USAGE or LEASE since renaming environment variables is a breaking change.
If a lease file is not provided, we default to fetching a lease file that our metrics automation uploads to B2 daily
Closes #7. I have a single question before considering this complete