예제 #1
0
def CreateCreateRequest(external_id,
                        parent,
                        workload,
                        release_track=ReleaseTrack.GA):
    """Construct an Assured Workload Create Request for Assured Workloads API requests.

  Args:
    external_id: str, the identifier that identifies this Assured Workloads
      environment externally.
    parent: str, the parent organization of the Assured Workloads environment
      to be created, in the form: organizations/{ORG_ID}/locations/{LOCATION}.
    workload: Workload, new Assured Workloads environment containing the values
      to be used.
    release_track: ReleaseTrack, gcloud release track being used

  Returns:
    A populated Assured Workloads Update Request for the Assured Workloads API.
  """
    if release_track == ReleaseTrack.GA:
        return util.GetMessagesModule(
            release_track
        ).AssuredworkloadsOrganizationsLocationsWorkloadsCreateRequest(
            externalId=external_id,
            parent=parent,
            googleCloudAssuredworkloadsV1Workload=workload)
    else:
        return util.GetMessagesModule(
            release_track
        ).AssuredworkloadsOrganizationsLocationsWorkloadsCreateRequest(
            externalId=external_id,
            parent=parent,
            googleCloudAssuredworkloadsV1beta1Workload=workload)
예제 #2
0
def CreateUpdateRequest(workload,
                        name,
                        update_mask,
                        release_track=ReleaseTrack.GA):
    """Construct an Assured Workload Update Request for Assured Workloads API requests.

  Args:
    workload: googleCloudAssuredworkloadsV1beta1Workload, new Assured Workloads
      environment containing the new configuration values to be used.
    name: str, the name for the Assured Workloads environment being updated
      in the form:
        organizations/{ORG_ID}/locations/{LOCATION}/workloads/{WORKLOAD_ID}.
    update_mask: str, list of the fields to be updated, for example,
      workload.display_name,workload.labels
    release_track: ReleaseTrack, gcloud release track being used

  Returns:
    A populated Assured Workloads Update Request for the Assured Workloads API.
  """
    messages = util.GetMessagesModule(release_track)
    if release_track == ReleaseTrack.GA:
        return messages.AssuredworkloadsOrganizationsLocationsWorkloadsPatchRequest(
            googleCloudAssuredworkloadsV1Workload=workload,
            name=name,
            updateMask=update_mask)
    else:
        return messages.AssuredworkloadsOrganizationsLocationsWorkloadsPatchRequest(
            googleCloudAssuredworkloadsV1beta1Workload=workload,
            name=name,
            updateMask=update_mask)
예제 #3
0
 def __init__(self, release_track, no_http=False):
     self.client = util.GetClientInstance(release_track, no_http)
     self.messages = util.GetMessagesModule(release_track)
     self._service = self.client.organizations_locations_operations
예제 #4
0
def GetMessages(release_track):
    return util.GetMessagesModule(release_track)