Skip to content

Commit

Permalink
add missing funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
rahul2393 committed Sep 30, 2022
1 parent 80b646f commit e137583
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Spanner/src/Connection/Grpc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1314,6 +1314,41 @@ private function createTransactionSelector(array &$args)
return $selector;
}

/**
* @param array $args
* @param bool $required
* @return InstanceConfig
*/
private function instanceConfigObject(array &$args, $required = false)
{
return $this->serializer->decodeMessage(
new InstanceConfig(),
$this->instanceConfigArray($args, $required)
);
}

/**
* @param array $args
* @param bool $required
* @return array
*/
private function instanceConfigArray(array &$args, $required = false)
{
$argsCopy = $args;
return array_intersect_key([
'name' => $this->pluck('name', $args, $required),
'baseConfig' => $this->pluck('baseConfig', $args, $required),
'displayName' => $this->pluck('displayName', $args, $required),
'configType' => $this->pluck('configType', $args, $required),
'replicas' => $this->pluck('replicas', $args, $required),
'optionalReplicas' => $this->pluck('optionalReplicas', $args, $required),
'leaderOptions' => $this->pluck('leaderOptions', $args, $required),
'reconciling' => $this->pluck('reconciling', $args, $required),
'state' => $this->pluck('state', $args, $required),
'labels' => $this->pluck('labels', $args, $required),
], $argsCopy);
}

/**
* @param array $args
* @param bool $required
Expand Down

0 comments on commit e137583

Please sign in to comment.