{"id":5631,"library":"google-cloud-os-config","title":"Google Cloud OS Config Client Library","description":"The Google Cloud OS Config client library for Python provides tools to manage operating systems on virtual machine instances, offering functionalities for patch management, patch compliance reporting, and configuration management. Currently at version 1.24.0, it is actively maintained as part of the broader google-cloud-python monorepo, with frequent updates and releases.","status":"active","version":"1.24.0","language":"en","source_language":"en","source_url":"https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-os-config","tags":["google cloud","os config","gcp","client library","os management","patch management"],"install":[{"cmd":"pip install google-cloud-os-config","lang":"bash","label":"Install latest stable version"}],"dependencies":[{"reason":"Core library for Google Cloud API clients, providing common functionalities like authentication, retries, and API request/response handling.","package":"google-api-core"},{"reason":"Handles authentication with Google Cloud, including service account credentials and user authentication.","package":"google-auth"}],"imports":[{"symbol":"OsConfigServiceClient","correct":"from google.cloud import osconfig_v1"},{"note":"For asynchronous operations, the async client is also available within the same module.","symbol":"OsConfigServiceAsyncClient","correct":"from google.cloud import osconfig_v1"}],"quickstart":{"code":"import os\nfrom google.cloud import osconfig_v1\n\ndef list_patch_jobs():\n    # Set your Google Cloud Project ID as an environment variable or replace 'your-project-id'\n    project_id = os.environ.get('GCP_PROJECT_ID', 'your-project-id')\n    if project_id == 'your-project-id':\n        print(\"Please set the 'GCP_PROJECT_ID' environment variable or replace 'your-project-id'.\")\n        return\n\n    client = osconfig_v1.OsConfigServiceClient()\n    parent_path = f\"projects/{project_id}\"\n\n    request = osconfig_v1.ListPatchJobsRequest(\n        parent=parent_path,\n    )\n\n    try:\n        page_result = client.list_patch_jobs(request=request)\n        print(f\"Patch jobs for project {project_id}:\")\n        for response in page_result:\n            print(f\"  - {response.name} (State: {response.state.name})\")\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n        print(\"Ensure the OS Config API is enabled for your project and your credentials are set up correctly.\")\n\nif __name__ == \"__main__\":\n    list_patch_jobs()\n","lang":"python","description":"This quickstart demonstrates how to instantiate the OS Config client and list patch jobs within a specified Google Cloud project. Ensure your `GCP_PROJECT_ID` environment variable is set and the OS Config API is enabled."},"warnings":[{"fix":"Upgrade your Python environment to 3.10 or newer.","message":"Python 3.9 is reaching or has reached End-of-Life (EOL) in late 2025/early 2026. While the PyPI `requires_python` currently indicates `>=3.9`, other Google Cloud client libraries are actively dropping official support for Python 3.9 as part of the monorepo's policy. Users on Python 3.9 should plan to upgrade to Python 3.10 or newer to ensure continued support and critical updates.","severity":"breaking","affected_versions":"All versions when used with Python 3.9"},{"fix":"Refer to Google Cloud authentication documentation. Ensure `GOOGLE_APPLICATION_CREDENTIALS` points to a valid service account key JSON file or that you are authenticated via `gcloud auth application-default login` with appropriate permissions for the OS Config API.","message":"Incorrect Google Cloud authentication setup. Common issues include missing or improperly configured `GOOGLE_APPLICATION_CREDENTIALS` environment variable, or the service account/user lacking necessary IAM permissions (e.g., `osconfig.patchJobs.list`).","severity":"gotcha","affected_versions":"All versions"},{"fix":"Consult the client library documentation or the Google Cloud API reference for the exact resource name format required by each method. For example, `ListPatchJobs` expects `projects/PROJECT_ID` as its parent argument.","message":"Misconfigured resource paths for API calls. Resource names for Google Cloud APIs follow specific patterns (e.g., `projects/PROJECT_ID`, `projects/PROJECT_ID/locations/LOCATION_ID`). Incorrect formatting will result in `NotFound` or `InvalidArgument` errors.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}