func readWorkspace()

in aws-aps-workspace/cmd/resource/resource.go [406:425]


func readWorkspace(client internal.APSService, currentModel *Model) (*prometheusservice.WorkspaceStatus, error) {
	_, workspaceID, err := internal.ParseARN(*currentModel.Arn)
	if err != nil {
		return nil, err
	}
	data, err := client.DescribeWorkspace(&prometheusservice.DescribeWorkspaceInput{
		WorkspaceId: aws.String(workspaceID),
	})
	if err != nil {
		return nil, err
	}

	currentModel.WorkspaceId = &workspaceID
	currentModel.Arn = data.Workspace.Arn
	currentModel.PrometheusEndpoint = data.Workspace.PrometheusEndpoint
	currentModel.Alias = data.Workspace.Alias
	currentModel.Tags = stringMapToTags(data.Workspace.Tags)

	return data.Workspace.Status, nil
}