GoogleCloudPlatform / samples-experiment

🧪 Experiment time! Let's see if a monorepo for Cloud samples is a good idea.
Apache License 2.0
3 stars 2 forks source link

feat: Adding a first example of metadata file to samples #16

Closed m-strzelczyk closed 11 months ago

m-strzelczyk commented 11 months ago

This file parses to something like this:

{'creation_date': datetime.date(2023, 11, 24),
 'deprecated': False,
 'description': 'Deletes an instance template from a project.',
 'give_this_a_name': {'effects': 'The template gets deleted.',
                      'required_apis': ['compute.googleapis.com'],
                      'required_permissions': ['compute.instanceTemplates.delete',
                                               'compute.instanceTemplates.get'],
                      'required_roles': ['roles/compute.admin'],
                      'requirements': 'The template mus exist... No special '
                                      'requirements or hidden catches here.'},
 'modification_date': datetime.date(2023, 11, 24),
 'region_tag': 'compute_template_delete',
 'standalone': True,
 'tests': [{'check': {'command': '! gcloud compute instance-templates list | '
                                 'grep $TEMPLATE_NAME'},
            'cleanup': {'commands': ['gcloud compute instance-templates delete '
                                     '--quiet $TEMPLATE_NAME']},
            'java': {'file': '../java/src/main/java/templates/DeleteInstanceTemplate.java',
                     'method': 'deleteInstanceTemplate',
                     'parameters': ['$PROJECT_ID', '$TEMPLATE_NAME'],
                     'pom': '../java/src/pom.xml'},
            'legacy': False,
            'parallel': False,
            'python': {'file': '../python/templates/delete.py',
                       'method': 'delete_instance_template',
                       'parameters': ['$PROJECT_ID', '$TEMPLATE_NAME'],
                       'requirements': '../python/templates/requirements.txt'},
            'setup': {'commands': ['gcloud compute instance-templates create '
                                   '$TEMPLATE_NAME']},
            'variables': {'PROJECT_ID': 'python-docs-samples',
                          'TEMPLATE_NAME': 'test-template-#####'}}],
 'title': 'Delete an instance template'}

Please let me know if this format makes sense and is readable. Also let me know if you think it contains all that is needed according to our docs.

Notes: